]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
a52: Ignore start request if we're already running
authorDavid Henningsson <david.henningsson@canonical.com>
Wed, 12 Nov 2014 14:55:43 +0000 (15:55 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 12 Nov 2014 15:14:24 +0000 (16:14 +0100)
When trying to start a PCM that's already running, the result is EBADFD.
We might have implicitly started the buffer by filling it up,
so just ignore this request if we're already running.

Reported-by: Chow Loong Jin <hyperair@ubuntu.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
a52/pcm_a52.c

index b467ec8e5abb40ae69d6572e4af4365e91e59843..59e25cbd5f46419398decc96a1e1d2fdd9be9902 100644 (file)
@@ -482,6 +482,12 @@ static int a52_start(snd_pcm_ioplug_t *io)
 {
        struct a52_ctx *rec = io->private_data;
 
+       /* When trying to start a PCM that's already running, the result is
+          EBADFD. We might have implicitly started the buffer by filling it
+          up, so just ignore this request if we're already running. */
+       if (snd_pcm_state(rec->slave) == SND_PCM_STATE_RUNNING)
+               return 0;
+
        return snd_pcm_start(rec->slave);
 }