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.
This commit is contained in:
Arun Raghavan 2024-08-15 11:25:40 -04:00 committed by Arun Raghavan
parent 9f643fec7e
commit 48c2e95165

View file

@ -361,7 +361,7 @@ static void rtp_audio_process_capture(void *data)
if (SPA_ABS((int)expected_timestamp - (int)timestamp) > (int)quantum) { if (SPA_ABS((int)expected_timestamp - (int)timestamp) > (int)quantum) {
pw_log_warn("expected %u != timestamp %u", expected_timestamp, timestamp); pw_log_warn("expected %u != timestamp %u", expected_timestamp, timestamp);
impl->have_sync = false; 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); pw_log_warn("overrun %u + %u > %u", filled, wanted, BUFFER_SIZE / stride);
impl->have_sync = false; impl->have_sync = false;
filled = 0; filled = 0;