Skip to main content

FecRate

Struct FecRate 

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

The loss-driven amount of FEC for one sender. See the module documentation.

Implementations§

Source§

impl FecRate

Source

pub fn new(media_packets: u32, fec_packets: u32, adaptive: bool) -> Self

fec_packets repair packets per media_packets source packets until the loss is known; adaptive false keeps that amount whatever the loss.

Source

pub fn with_latency_budget(self, latency_budget: Option<Duration>) -> Self

The round trip within which a stream that can be repaired by retransmission gets no FEC (RFC 8854 section 8); FEC_DEFAULT_LATENCY_BUDGET by default. None is the application paying for proactive FEC: the amount follows the loss whatever the round trip.

Source

pub fn latency_budget(&self) -> Option<Duration>

The latency budget in force.

Source

pub fn round_trip_time(&self) -> Option<Duration>

The newest round trip measured to the receiver of a protected stream.

Source

pub fn on_round_trip_time(&mut self, round_trip_time: Duration)

A round trip measured to the receiver of a protected stream.

Source

pub fn retransmission_preferred(&self) -> bool

Whether retransmission is to repair a stream that can be retransmitted, rather than FEC: the amount follows the loss, a latency budget is set, and the round trip measured is within it.

Source

pub fn fec_packets_with(&self, retransmission: bool) -> u32

Repair packets for the next block of a stream; retransmission: whether the stream can be repaired by retransmission. None while retransmission_preferred, otherwise fec_packets.

Source

pub fn fec_packets_for(&self, media_packets: u32, retransmission: bool) -> u32

Repair packets for a block of media_packets source packets that closed short (or is shorter than the configured block), as fec_packets_with decides for a full one, and never more than the block has packets.

Source

pub fn on_acknowledgements( &mut self, ssrc: Option<u32>, acknowledgements: &[Acknowledgement], )

Per-packet feedback for one sequence number space: ssrc names the stream an RFC 8888 report is about, None is transport-wide feedback. Feeds loss_pattern.

Source

pub fn loss_pattern(&self) -> Option<LossPattern>

Whether the recent losses were isolated, in bursts, or both (the last 32 runs of lost packets; None before four runs were seen).

Source

pub fn with_max(self, max: u32) -> Self

The most repair packets per block, whatever the loss.

Source

pub fn max(&self) -> u32

The most repair packets per block.

Source

pub fn adaptive(&self) -> bool

Whether the amount follows the loss (false: the configured amount whatever happens).

Source

pub fn loss(&self) -> Option<f64>

The smoothed loss fraction, once a report gave one.

Source

pub fn on_fraction_lost(&mut self, fraction_lost: u8)

A receiver report’s fraction lost (RFC 3550 6.4.1, in 1/256) for a protected stream.

Source

pub fn fec_packets(&self) -> u32

Repair packets for the next block.

Source

pub fn protects(&self) -> bool

Whether any repair is to be sent now (for protection shapes whose amount is fixed: sent or not).

Source

pub fn on_repair_sent(&mut self, now: Instant, size: usize)

A repair packet of size octets left at now.

Source

pub fn fec_bitrate(&mut self, now: Instant) -> f64

The bit rate of the repair packets of the last second at now.

Source

pub fn media_target(&mut self, now: Instant, target: f64) -> f64

The target the application encodes at, out of the congestion controller’s target: what is left after the FEC.

Source

pub fn on_read( &mut self, msg: &mut TaggedPacket, protected: impl Fn(u32) -> bool, )

Reads what an inbound packet tells the FEC rate, and takes the FEC out of a target it carries: the receiver reports of protected streams feed the loss, the round trip the RTCP session measured to one of them the latency rule, per-packet feedback (transport-wide, and RFC 8888 reports on protected streams) the loss pattern, and an Attribute::TargetBitrateChanged on the packet is lowered by the FEC bit rate.

Trait Implementations§

Source§

impl Clone for FecRate

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 Debug for FecRate

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for FecRate

§

impl Freeze for FecRate

§

impl Move for FecRate

§

impl RefUnwindSafe for FecRate

§

impl Send for FecRate
where RawVecInner: Send, RawTable<(Option<u32>, (u16, u32))>: Send,

§

impl Sync for FecRate
where RawVecInner: Sync, RawTable<(Option<u32>, (u16, u32))>: Sync,

§

impl Unpin for FecRate
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for FecRate

§

impl UnwindSafe for FecRate
where RawVecInner: UnwindSafe, HashMap<Option<u32>, (u16, u32)>: 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> 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.