From 8033ff9996b7f04531f1e161bcf6af7673346669 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 Aug 2022 17:21:12 +0200 Subject: pcm: fix the dshare delay reporting 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 --- src/pcm/pcm_dshare.c | 2 +- src/pcm/pcm_dsnoop.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index d3a2b456..d7be8fbb 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -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; diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 8c4cde05..cb2eee32 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -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; -- cgit v1.2.1