Skip to main content

JitterBufferBuilder

Struct JitterBufferBuilder 

Source
pub struct JitterBufferBuilder { /* private fields */ }
Expand description

Builder for JitterBufferInterceptor.

§Example

use rtci_interceptor::{Slot, JitterBufferBuilder, Registry};
use std::time::Duration;

let chain = Registry::new()
    .with(Slot::JitterBuffer, JitterBufferBuilder::new().with_depth(Duration::from_millis(80)).build())
    .build();

Implementations§

Source§

impl JitterBufferBuilder

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 with_discard_count(self, discards: &JitterBufferDiscards) -> Self

Counts what each stream’s buffer discards into discards, for the discard rate of the XR VoIP Metrics block (RFC 3611 section 4.7.1): give the same handle to XrReportBuilder::with_jitter_buffer_discards.

Source

pub fn build(self) -> JitterBufferInterceptor

Build the interceptor.

Trait Implementations§

Source§

impl Default for JitterBufferBuilder

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Forget for JitterBufferBuilder

§

impl Freeze for JitterBufferBuilder
where *const ArcInner<Mutex<HashMap<u32, StreamDiscards>>> is !null: Freeze, PhantomData<ArcInner<Mutex<HashMap<u32, StreamDiscards>>>>: Freeze,

§

impl Move for JitterBufferBuilder

§

impl RefUnwindSafe for JitterBufferBuilder
where Atomic<usize>: RefUnwindSafe, Mutex<HashMap<u32, StreamDiscards>>: RefUnwindSafe,

§

impl Send for JitterBufferBuilder
where Arc<Mutex<HashMap<u32, StreamDiscards>>>: Send,

§

impl Sync for JitterBufferBuilder
where Arc<Mutex<HashMap<u32, StreamDiscards>>>: Sync,

§

impl Unpin for JitterBufferBuilder
where Arc<Mutex<HashMap<u32, StreamDiscards>>>: Unpin,

§

impl UnsafeUnpin for JitterBufferBuilder
where *const ArcInner<Mutex<HashMap<u32, StreamDiscards>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<HashMap<u32, StreamDiscards>>>>: UnsafeUnpin,

§

impl UnwindSafe for JitterBufferBuilder
where Arc<Mutex<HashMap<u32, StreamDiscards>>>: 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.