pub struct JitterBufferBuilder<P> { /* private fields */ }Expand description
Builder for JitterBufferInterceptor.
§Example
use rtc_interceptor::{JitterBufferBuilder, Registry};
use std::time::Duration;
let chain = Registry::new()
.with(JitterBufferBuilder::new().with_depth(Duration::from_millis(80)).build())
.build();Implementations§
Source§impl<P> JitterBufferBuilder<P>
impl<P> JitterBufferBuilder<P>
Sourcepub fn with_depth(self, depth: Duration) -> Self
pub fn with_depth(self, depth: Duration) -> Self
How long a packet is held to absorb arrival-time variation.
§Its relationship with NACK
This is the delay the buffer adds, and it is also the window in which a retransmission is still useful. A lost packet cannot come back before
detection (up to one NACK interval) + round trip + the sender's responsehas elapsed, and the buffer plays a position out one depth after that position is due. So a depth shallower than that sum means every retransmission arrives too late — its slot has already been played past, so it is dropped rather than emitted out of order, and the NACK traffic was spent for nothing.
The two are deliberately not coupled: a mechanism for the jitter buffer and the NACK
generator to negotiate would tie together interceptors that are otherwise independent, and
an application that configures both can honour the inequality itself.
tests/jitter_buffer_nack_depth.rs holds it to that — the same loss recovered under a
depth chosen to accommodate it and lost under one chosen not to.
Sourcepub fn with_capacity(self, capacity: usize) -> Self
pub fn with_capacity(self, capacity: usize) -> Self
Maximum packets held per stream, independently of the time depth.
Sourcepub fn build(self) -> impl FnOnce(P) -> JitterBufferInterceptor<P>
pub fn build(self) -> impl FnOnce(P) -> JitterBufferInterceptor<P>
Build the interceptor factory function.