OSDN Git Service

pcm: direct: Fix the missing appl_ptr update
authorTakashi Iwai <tiwai@suse.de>
Fri, 22 Jan 2021 14:48:39 +0000 (15:48 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 22 Jan 2021 16:58:07 +0000 (17:58 +0100)
A snd_pcm_status() call for the direct plugins receives the status
from the slave PCM, but this doesn't contain a valid appl_ptr, since
the slave PCM for the direct plugins is in a free-wheel mode, hence
the appl_ptr is always zero.  This result in the inconsistent
status->appl_ptr and pcm->appl.ptr, hitting the recently introduced
assert() call.

Fix it by transferring the plugin's appl_ptr to the upper caller.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1181194
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_dmix.c
src/pcm/pcm_dshare.c
src/pcm/pcm_dsnoop.c

index be2675a..d849506 100644 (file)
@@ -495,6 +495,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
        }
 
        status->state = snd_pcm_dmix_state(pcm);
+       status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */
        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;
index 1024301..dccb137 100644 (file)
@@ -243,6 +243,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
                break;
        }
        status->state = snd_pcm_dshare_state(pcm);
+       status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */
        status->trigger_tstamp = dshare->trigger_tstamp;
        status->avail = snd_pcm_mmap_playback_avail(pcm);
        status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
index c6e8cd2..695bf4a 100644 (file)
@@ -193,6 +193,7 @@ static int snd_pcm_dsnoop_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
        snd_pcm_status(dsnoop->spcm, status);
        state = snd_pcm_state(dsnoop->spcm);
        status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state;
+       status->appl_ptr = *pcm->appl.ptr; /* slave PCM doesn't set appl_ptr */
        status->trigger_tstamp = dsnoop->trigger_tstamp;
        status->avail = snd_pcm_mmap_capture_avail(pcm);
        status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max;