]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: fix the dshare delay reporting
authorJaroslav Kysela <perex@perex.cz>
Tue, 16 Aug 2022 15:21:12 +0000 (17:21 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Aug 2022 15:22:36 +0000 (17:22 +0200)
Pulseaudio uses full ring buffer when the incorrect delay is reported.

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

index d3a2b456189ed1e9bf432bb4f46ae9caa85039f0..d7be8fbb4dc2d72b5dff52b49eacb50afa52aaa5 100644 (file)
@@ -229,7 +229,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
        case SNDRV_PCM_STATE_DRAINING:
        case SNDRV_PCM_STATE_RUNNING:
                snd_pcm_dshare_sync_ptr0(pcm, status->hw_ptr);
-               status->delay += snd_pcm_mmap_playback_delay(pcm);
+               status->delay = snd_pcm_mmap_playback_delay(pcm);
                break;
        default:
                break;
index 8c4cde0567f322fc33e0004f00ffa45ef64dc8a5..cb2eee32887978c10da0f092a8ac47bcee5ba557 100644 (file)
@@ -215,7 +215,7 @@ static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
                /* Fall through */
        case SNDRV_PCM_STATE_PREPARED:
        case SNDRV_PCM_STATE_SUSPENDED:
-               *delayp = snd_pcm_mmap_capture_avail(pcm);
+               *delayp = snd_pcm_mmap_capture_delay(pcm);
                return 0;
        case SNDRV_PCM_STATE_XRUN:
                return -EPIPE;