Skip to main content

JitterBufferBuilder

Struct JitterBufferBuilder 

Source
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>

Source

pub fn new() -> Self

Create a builder with the default depth and capacity.

Source

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 response

has 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.

Source

pub fn with_capacity(self, capacity: usize) -> Self

Maximum packets held per stream, independently of the time depth.

Source

pub fn build(self) -> impl FnOnce(P) -> JitterBufferInterceptor<P>

Build the interceptor factory function.

Trait Implementations§

Source§

impl<P> Default for JitterBufferBuilder<P>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<P> Freeze for JitterBufferBuilder<P>

§

impl<P> RefUnwindSafe for JitterBufferBuilder<P>
where P: RefUnwindSafe,

§

impl<P> Send for JitterBufferBuilder<P>
where P: Send,

§

impl<P> Sync for JitterBufferBuilder<P>
where P: Sync,

§

impl<P> Unpin for JitterBufferBuilder<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for JitterBufferBuilder<P>

§

impl<P> UnwindSafe for JitterBufferBuilder<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.