From: Takashi Iwai Date: Wed, 19 Dec 2018 13:23:38 +0000 (+0100) Subject: pcm: ioplug: Fix the regression of pulse plugin drain X-Git-Tag: v1.1.8~17 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d7ba06afce54f386eda1eec462f27824fb4c380f;p=alsa-lib.git pcm: ioplug: Fix the regression of pulse plugin drain 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 Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index 881a1a85..1e25190a 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -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;