From 4f39329ca9af6b9de8f3e8693e675de523b3894a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 1 Dec 2025 14:20:12 +0100 Subject: [PATCH] alsa: use graph rate for rate latency When we recalculate the headroom we also update the latency in frames. We should express this latency in the graph rate. This is usually the rate that is suggested in the target_rate but when we are forcing our own rate (mostly when using IRQ or when in DSD/IEC mode) we should ignore that value and use our own rate that we will force instead. Fixes #4977 --- spa/plugins/alsa/alsa-pcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index f919a9eb1..af11848a7 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -2036,7 +2036,9 @@ static void recalc_headroom(struct state *state) uint32_t latency; uint32_t rate = 0; - if (state->position != NULL) + if (state->force_quantum && !state->following) + rate = state->rate; + else if (state->position != NULL) rate = state->position->clock.target_rate.denom; if (state->use_period_size_min_as_headroom)