Skip to main content

FlexFec03Decoder

Struct FlexFec03Decoder 

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

Recovers media packets lost from a stream protected by FlexFEC draft-03.

Feed it every packet of both streams — media and repair — and it returns whatever it was able to rebuild. A repair packet recovers exactly one loss among the packets it covers, which is why the encoder interleaves: consecutive losses land under different repair packets.

§Difference from upstream

pion/interceptor stores each protected packet as a pointer into the recovered-packet slice, then appends to and sorts that same slice. Appending can reallocate and sorting reorders, so those pointers can dangle or come to refer to a different packet. Copies are held here instead: the borrow checker would not permit the upstream shape, and the bug it prevents is real.

Implementations§

Source§

impl FlexFec03Decoder

Source

pub fn new(repair_ssrc: u32, media_ssrc: u32) -> Self

A decoder for media_ssrc, protected by the repair stream on repair_ssrc.

Source

pub fn decode(&mut self, packet: Packet) -> Vec<Packet>

Offer a packet from either stream, returning any media packets it made recoverable.

Recovery can cascade: rebuilding one packet may complete another repair packet that was waiting on two losses, so this repeats until nothing further can be recovered.

Source

pub fn recovered_len(&self) -> usize

Media packets currently held, whether received or recovered.

Source

pub fn pending_repair_packets(&self) -> usize

Repair packets currently held while waiting for the media they protect.

Trait Implementations§

Source§

impl Debug for FlexFec03Decoder

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