]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: direct plugins - fix hw_ptr in the status callback
authorJaroslav Kysela <perex@perex.cz>
Mon, 21 Jun 2021 07:28:41 +0000 (09:28 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 21 Jun 2021 07:28:43 +0000 (09:28 +0200)
The parent hw_ptr may be in another range (boundary limit).
Set the correct value for the caller.

BugLink: https://github.com/alsa-project/alsa-lib/issues/155
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_dmix.c
src/pcm/pcm_dshare.c
src/pcm/pcm_dsnoop.c

index 0d0d0bff6668008d7e16825d27f9573a24ec7e0c..94dbb1e00621faf26f824397d5ae146fde69914a 100644 (file)
@@ -491,6 +491,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
        }
 
        status->state = snd_pcm_dmix_state(pcm);
+       status->hw_ptr = *pcm->hw.ptr; /* boundary may be different */
        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);
index a918512bc20ce3d37430c2c7172f6f7ddcd36ba3..01814dc8e70d69fea6b7f07e640edb8312cedb22 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->hw_ptr = *pcm->hw.ptr; /* boundary may be different */
        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);
index 2c3b9f438de5c3e12a08a6a4511ff0108edddab9..3f28df9924a440a7e821037129a7d44448fea9d5 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->hw_ptr = *pcm->hw.ptr; /* boundary may be different */
        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);