]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: ioplug: Fix the regression of pulse plugin drain
authorTakashi Iwai <tiwai@suse.de>
Wed, 19 Dec 2018 13:23:38 +0000 (14:23 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 19 Dec 2018 13:23:38 +0000 (14:23 +0100)
The recent change to support the drain via polling caused a regression
for pulse plugin; with speaker-test -c2 -twav with pulse, it leads to
either no sounds or stall.

The only sensible behavior change in the commit wrt pulse plugin is
that now it starts the stream before calling drain callback.  This
supposed to be correct, but it seems hitting a pulse plugin bug.

The start before drain callback is only a matter of consistency, and
since this doesn't work for the single existing plugin using drain
callback, we don't need to stick with this behavior.

For addressing the regression, we check the presence of the drain
callback and start the stream only when it doesn't exist, i.e. only in
drain-via-poll mode.

Fixes: ce2095c41f28 ("pcm: ioplug: Implement proper drain behavior")
Reported-by: Diego Viola <diego.viola@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_ioplug.c

index 881a1a85adaf09b4732375e2161b0a1ebb53900f..1e25190a0f71488e8e6e2db60a6df8758583331a 100644 (file)
@@ -537,9 +537,11 @@ static int snd_pcm_ioplug_drain(snd_pcm_t *pcm)
                return -EBADFD;
        case SND_PCM_STATE_PREPARED:
                if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
-                       err = snd_pcm_ioplug_start(pcm);
-                       if (err < 0)
-                               goto unlock;
+                       if (!io->data->callback->drain) {
+                               err = snd_pcm_ioplug_start(pcm);
+                               if (err < 0)
+                                       goto unlock;
+                       }
                        io->data->state = SND_PCM_STATE_DRAINING;
                }
                break;