]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
pcm_a52: Don't pass EAGAIN errors from the slave to the caller
authorAlexander Motzkau <a.motzkau@web.de>
Wed, 18 Mar 2020 21:33:44 +0000 (22:33 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 25 May 2021 16:01:13 +0000 (18:01 +0200)
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 <a.motzkau@web.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
a52/pcm_a52.c

index 653de12d7fd2e0a6b725dbdbad116848ef8d79d4..1715751ddf7a8d0f9c54f9084083a6f0ff1fa3a3 100644 (file)
@@ -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;