From b5a997479527df597ed48a5b1ab6cab63e9d9a13 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 Sep 2024 10:44:51 +0200 Subject: [PATCH] module-rtp: don't confuse time and samples Round down the target_buffer size to a psamples multiple. Don't try to mix time and sample units for this. Fixes #4327 --- src/modules/module-rtp/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/module-rtp/stream.c b/src/modules/module-rtp/stream.c index 29e55ea9e..2f6591a91 100644 --- a/src/modules/module-rtp/stream.c +++ b/src/modules/module-rtp/stream.c @@ -518,7 +518,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core, if (fmodf(impl->target_buffer, impl->psamples) != 0) { pw_log_warn("sess.latency.msec %f should be an integer multiple of rtp.ptime %f", latency_msec, ptime); - impl->target_buffer = (uint32_t)((impl->target_buffer / ptime) * impl->psamples); + impl->target_buffer = SPA_ROUND_DOWN(impl->target_buffer, impl->psamples); } pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", impl->rate);