From: Takashi Iwai Date: Tue, 30 May 2017 21:08:51 +0000 (+0200) Subject: pcm: dmix: Fix the inconsistent PCM state X-Git-Tag: v1.1.4.1~1 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=3752e6b8733d;p=alsa-lib.git pcm: dmix: Fix the inconsistent PCM state The commit 38a2d2eda880 ("pcm: dmix: Do not discard slave reported delay in...") changed the handling in snd_pcm_dmix_status() for taking the actual delay from the slave PCM status. Along with it, the commit removed the line to update its own state altogether, as it had been done originally in the dshare patch (commit faf53c197cab "pcm_dshare: Do not discard slave reported delay..."), supposing that the slave PCM keeps this same state. However, for dmix/dshare, the PCM state may differ from the slave, thus these changes resulted in the inconsistent PCM state. For dshare, the issue was already addressed by commit ad6957c61867 ("plugin:dshare: wrong state reporting"), while the fix for dmix was forgotten until now. This patch restores the code to set the proper dmix PCM state again like in the previous versions. Fixes: 38a2d2eda880 ("pcm: dmix: Do not discard slave reported delay in...") Reported-by: Cheng Sun Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index c64ae5fc..a6a8f3a8 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -501,6 +501,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) break; } + status->state = snd_pcm_dmix_state(pcm); status->trigger_tstamp = dmix->trigger_tstamp; status->avail = snd_pcm_mmap_playback_avail(pcm); status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;