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 <stanislav.ruzani@streamunlimited.com>
This commit is contained in:
Stanislav Ruzani 2025-12-28 23:42:57 +01:00 committed by Carlos Rafael Giani
parent bac776f8b4
commit 64e0a9cbd9

View file

@ -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);