From e383678bc51c6f810a72f7662c8fb85ba91d5320 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Mon, 28 Oct 2024 15:35:07 +0200 Subject: [PATCH] Take into account RTP packets header sizes when calculating BWE and pacing --- CHANGELOG.md | 1 + src/session.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c42c32e..359b5c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * Configure RTX ratio cap via `StreamTx::set_rtx_cache` #570 * Correctly handle per m-line TWCC #573 * Correctly handle per m-line Absolute Send Time #575 + * Take into account RTP packets header sizes when calculating BWE and pacing #581 # 0.6.1 * Force openssl to be >=0.10.66 #545 diff --git a/src/session.rs b/src/session.rs index a50cf33d..76b84f80 100644 --- a/src/session.rs +++ b/src/session.rs @@ -730,7 +730,7 @@ impl Session { crate::log_stat!("PACKET_SENT", header.ssrc, payload_size, kind); } - self.pacer.register_send(now, payload_size.into(), mid); + self.pacer.register_send(now, buf.len().into(), mid); if let Some(raw_packets) = &mut self.raw_packets { raw_packets.push_back(Box::new(RawPacket::RtpTx(header.clone(), buf.clone()))); @@ -740,7 +740,7 @@ impl Session { if twcc_enabled { self.twcc_tx_register - .register_seq(twcc_seq.into(), now, payload_size); + .register_seq(twcc_seq.into(), now, buf.len()); } // Technically we should wait for the next handle_timeout, but this speeds things up a bit