Skip to main content

FlexFecDecoder

Struct FlexFecDecoder 

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

Recovers lost source packets from RFC 8627 FlexFEC repair packets (flexfec, not flexfec-03): flexible masks, fixed L/D rows and columns (1-D and 2-D, decoded iteratively), retransmissions, and repair packets that protect several source streams.

Every packet of the protected source streams goes to push_source, every packet of the repair stream to push_repair; both return the source packets that became available.

§Bounds

Only streams registered with add_source_stream are buffered: a repair packet naming any other SSRC is ignored, so a peer cannot make the decoder open buffers by inventing CSRCs. Per stream at most max_source_packets are kept, for at most the repair window; a repair packet whose L and D reach beyond that is ignored. Length recovery can never ask for more than the repair packet itself holds.

Implementations§

Source§

impl FlexFecDecoder

Source

pub fn new(config: FlexFecDecoderConfig) -> Self

A decoder with no source stream registered.

Source

pub fn config(&self) -> &FlexFecDecoderConfig

The bounds this decoder runs with.

Source

pub fn widen(&mut self, config: FlexFecDecoderConfig)

Raise each bound to at least config’s: another stream joined with a longer repair window. Bounds are never lowered while packets are held against them.

Source

pub fn stats(&self) -> FlexFecDecoderStats

Counters.

Source

pub fn add_source_stream(&mut self, ssrc: u32)

Protect the source stream ssrc: buffer its packets and accept repair packets for it.

Source

pub fn remove_source_stream(&mut self, ssrc: u32)

Stop protecting ssrc, dropping what was held for it.

Source

pub fn protects(&self, ssrc: u32) -> bool

Whether ssrc is a protected source stream.

Source

pub fn source_streams(&self) -> impl Iterator<Item = u32> + '_

The protected source streams.

Source

pub fn held_source_packets(&self) -> usize

Source packets held, over all streams.

Source

pub fn pending_repair_packets(&self) -> usize

Repair packets held while they wait for sources.

Source

pub fn push_source(&mut self, now: Instant, packet: &Packet) -> Vec<Packet>

Offer a packet of a protected source stream that arrived at now. Returns the source packets it made recoverable.

Source

pub fn push_repair(&mut self, now: Instant, packet: &Packet) -> Vec<Packet>

Offer a packet of the repair stream that arrived at now. Returns the source packets it made available: rebuilt from parity, or carried whole by a retransmission and not held before.

Trait Implementations§

Source§

impl Debug for FlexFecDecoder

Source§

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

Formats the value using the given formatter. Read more

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