Skip to main content

ToneIntervalControl

Struct ToneIntervalControl 

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

The packetization interval of initial and interim tone reports under congestion (RFC 4733 section 4.4.3): “If the sender determines that packets are being lost due to congestion (e.g., through RTCP receiver reports), it SHOULD increase the packetization interval for initial and interim tone reports … Both the maximum packetization interval and maximum increase in packetization interval at any one time are therefore a matter of configuration”.

Feed it the fraction lost of each RTCP receiver report about the stream (on_receiver_report). A report at or above the high threshold (TONE_HIGH_LOSS_FRACTION by default) lengthens the interval by at most the configured increase, up to the configured maximum; one at or below the low threshold (TONE_LOW_LOSS_FRACTION) shortens it by the same step, back to the initial interval (the RFC leaves the way back open); one between leaves it. Durations are in timestamp units of the tone clock.

Implementations§

Source§

impl ToneIntervalControl

Source

pub fn new(initial: u16, maximum: u16, max_increase: u16) -> Self

Starts at initial (at least 1), never above maximum (at least initial), and changes by at most max_increase (at least 1) per receiver report.

Source

pub fn with_loss_thresholds(self, high: u8, low: u8) -> Self

The fraction lost (out of 256) at or above which a report means congestion, and the one at or below which it means none. The high threshold is tested first.

Source

pub fn packet_duration(&self) -> u16

The current packetization interval.

Source

pub fn on_receiver_report(&mut self, fraction_lost: u8) -> u16

Takes the fraction lost (the 8-bit field of an RTCP report block, RFC 3550 section 6.4.1) and returns the packetization interval from now on.

Source

pub fn sender(&self) -> ToneSender

A ToneSender cutting tones at the current interval.

Trait Implementations§

Source§

impl Clone for ToneIntervalControl

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ToneIntervalControl

Source§

impl Debug for ToneIntervalControl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ToneIntervalControl

Source§

impl PartialEq for ToneIntervalControl

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ToneIntervalControl

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.