From a5717e37fda2de350ffd70541a0f309767c344f3 Mon Sep 17 00:00:00 2001 From: Alexander Motzkau Date: Wed, 18 Mar 2020 22:33:44 +0100 Subject: [PATCH] pcm_a52: Don't pass EAGAIN errors from the slave to the caller EAGAIN can happen when we already could have passed frames to the slave. If we then return EAGAIN to our caller it wrongly indicates that no frames were send. Therefore return the processed frames instead. BugLink: https://github.com/alsa-project/alsa-plugins/pull/8 Signed-off-by: Alexander Motzkau Signed-off-by: Jaroslav Kysela --- a52/pcm_a52.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c index 653de12..1715751 100644 --- a/a52/pcm_a52.c +++ b/a52/pcm_a52.c @@ -154,6 +154,8 @@ static int write_out_pending(snd_pcm_ioplug_t *io, struct a52_ctx *rec) if (err < 0) { if (err == -EPIPE) io->state = SND_PCM_STATE_XRUN; + if (err == -EAGAIN) + break; return err; } else if (! err) break; @@ -312,7 +314,7 @@ static snd_pcm_sframes_t a52_transfer(snd_pcm_ioplug_t *io, do { err = fill_data(io, areas, offset, size, interleaved); - if (err < 0) + if (err <= 0) break; offset += (unsigned int)err; size -= (unsigned int)err; -- 2.47.1