From 64e0a9cbd96f4eacf3b9f0435f59fbeda792f6f9 Mon Sep 17 00:00:00 2001 From: Stanislav Ruzani Date: Sun, 28 Dec 2025 23:42:57 +0100 Subject: [PATCH] alsa-pcm: set rate_match rate to 1.0 when not matching Only set rate_match rate to DLL correction when matching is active. When ALSA is driver and not matching, set rate to 1.0 to indicate no rate adjustment needed. DLL still runs for buffer level management but rate_match should not expose correction when matching is inactive to avoid confusion during debugging. Signed-off-by: Stanislav Ruzani --- spa/plugins/alsa/alsa-pcm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index a12b2601a..ca31366dc 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -3040,10 +3040,17 @@ static int update_time(struct state *state, uint64_t current_time, snd_pcm_sfram } if (state->rate_match) { - if (state->stream == SND_PCM_STREAM_PLAYBACK) - state->rate_match->rate = corr; - else - state->rate_match->rate = 1.0/corr; + /* Only set rate_match rate when matching is active. When not matching, + * set it to 1.0 to indicate no rate adjustment needed, even though DLL + * may still be running for buffer level management. */ + if (state->matching) { + if (state->stream == SND_PCM_STREAM_PLAYBACK) + state->rate_match->rate = corr; + else + state->rate_match->rate = 1.0/corr; + } else { + state->rate_match->rate = 1.0; + } if (state->pitch_elem && state->matching) spa_alsa_update_rate_match(state);