Summary
The pacer should add a max burst size limit to prevent overfilling socket buffers at high bitrates, similar to WebRTC's implementation.
Context
From PR #823 review discussion by @k0nserv on src/pacer/leaky.rs:290:
Maybe we should add in the max burst thing here too
WebRTC Reference
WebRTC's PacingController has a kMaxBurstSize constant of 63KB:
// modules/pacing/pacing_controller.h:89
static constexpr DataSize kMaxBurstSize = DataSize::Bytes(63 * 1000);
And uses it to cap burst intervals:
// modules/pacing/pacing_controller.cc:353-356
// Ensure that a burst of sent packet is not larger than kMaxBurstSize in
// order to not risk overfilling socket buffers at high bitrate.
TimeDelta send_burst_interval =
std::min(send_burst_interval_, kMaxBurstSize / adjusted_media_rate_);
Current str0m code
In src/pacer/leaky.rs:290, the normal pacing path calculates drain time but does not cap the burst size:
let drain_debt_time = self.media_debt / self.adjusted_bitrate;
let next_send_offset = if drain_debt_time > PACING {
drain_debt_time
} else {
Duration::ZERO
};
Suggested fix
Add a max burst size constant and use it to limit the burst interval:
const MAX_BURST_SIZE: DataSize = DataSize::bytes(63_000);
// In poll_action:
let max_burst_interval = MAX_BURST_SIZE / self.adjusted_bitrate;
// Apply min with send_burst_interval
Related
Summary
The pacer should add a max burst size limit to prevent overfilling socket buffers at high bitrates, similar to WebRTC's implementation.
Context
From PR #823 review discussion by @k0nserv on
src/pacer/leaky.rs:290:WebRTC Reference
WebRTC's
PacingControllerhas akMaxBurstSizeconstant of 63KB:And uses it to cap burst intervals:
Current str0m code
In
src/pacer/leaky.rs:290, the normal pacing path calculates drain time but does not cap the burst size:Suggested fix
Add a max burst size constant and use it to limit the burst interval:
Related