From 48c2e9516585ccc791335bc7baf4af6952ec54a0 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Thu, 15 Aug 2024 11:25:40 -0400 Subject: [PATCH] module-rtp: Clamp buffer fill level check on send side This is based on target_buffer which is likely to be much smaller than BUFFER_SIZE (currently 4MB). This is already done on the receive side. --- src/modules/module-rtp/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/module-rtp/audio.c b/src/modules/module-rtp/audio.c index 453179330..01ed99150 100644 --- a/src/modules/module-rtp/audio.c +++ b/src/modules/module-rtp/audio.c @@ -361,7 +361,7 @@ static void rtp_audio_process_capture(void *data) if (SPA_ABS((int)expected_timestamp - (int)timestamp) > (int)quantum) { pw_log_warn("expected %u != timestamp %u", expected_timestamp, timestamp); impl->have_sync = false; - } else if (filled + wanted > (int32_t)(BUFFER_SIZE / stride)) { + } else if (filled + wanted > (int32_t)SPA_MIN(impl->target_buffer * 8, BUFFER_SIZE / stride)) { pw_log_warn("overrun %u + %u > %u", filled, wanted, BUFFER_SIZE / stride); impl->have_sync = false; filled = 0;