From f3230ca2e68a9b1496a419f67b0613f6c26be049 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 10 Mar 2023 17:29:43 +0100 Subject: [PATCH] module-rtp: fix sender latency The sender should ask for a latency that matches the packet size, not the playout latency, that is for the receiver only. --- src/modules/module-rtp/stream.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/module-rtp/stream.c b/src/modules/module-rtp/stream.c index 975f83b47..568d4fc36 100644 --- a/src/modules/module-rtp/stream.c +++ b/src/modules/module-rtp/stream.c @@ -362,8 +362,13 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core, impl->max_error = msec_to_samples(impl, ERROR_MSEC); pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", impl->rate); - pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", - impl->target_buffer / 2, impl->rate); + if (direction == PW_DIRECTION_INPUT) { + pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", + impl->psamples, impl->rate); + } else { + pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", + impl->target_buffer / 2, impl->rate); + } pw_properties_setf(props, "net.mtu", "%u", impl->mtu); pw_properties_setf(props, "rtp.ptime", "%u",