From 8ee1b4b614f46d45c4546d021008d139f7878f88 Mon Sep 17 00:00:00 2001 From: Martin Louazel Date: Fri, 6 Dec 2024 15:24:55 +0100 Subject: [PATCH] context: fix erroneous clamping of quantum for high sample rates When calculating the adjusted max quantum based off of max_latency, the first multiplication can overflow uint32_t, leading to the quantum being wrongfully clamped down. Signed-off-by: Martin Louazel --- src/pipewire/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index a57e7a14b..918bcbde2 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1791,7 +1791,7 @@ again: /* calculate desired quantum. Don't limit to the max_latency when we are * going to force a quantum or rate and reconfigure the nodes. */ if (max_latency.denom != 0 && !force_quantum && !force_rate) { - uint32_t tmp = (max_latency.num * current_rate / max_latency.denom); + uint32_t tmp = ((uint64_t)max_latency.num * current_rate / max_latency.denom); if (tmp < node_max_quantum) node_max_quantum = tmp; }