From: Alexander Motzkau Date: Wed, 18 Mar 2020 21:33:44 +0000 (+0100) Subject: pcm_a52: Don't pass EAGAIN errors from the slave to the caller X-Git-Tag: v1.2.5~2 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=a5717e37fda2de350ffd70541a0f309767c344f3;p=alsa-plugins.git 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 --- 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;