Skip to main content

FlexFecEncoder

Struct FlexFecEncoder 

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

Builds RFC 8627 FlexFEC repair packets: the format negotiated as flexfec (video/flexfec and the other three media types of RFC 8627 section 5.1), not flexfec-03.

One encoder is one repair stream: its own SSRC, payload type and sequence numbers. It may protect several source streams (section 4.2.2.1), which it names in the CSRC list of each repair packet.

Implementations§

Source§

impl FlexFecEncoder

Source

pub fn new(payload_type: u8, ssrc: u32) -> Self

A repair-stream encoder sending payload_type on ssrc, its sequence numbers starting at 0 until with_base_sequence_number says otherwise.

Source

pub fn with_base_sequence_number(self, sequence_number: u16) -> Self

Start the repair stream’s sequence numbers at sequence_number. Section 4.2.1 wants the initial value random; the send interceptor draws one.

Source

pub fn next_sequence_number(&self) -> u16

The sequence number the next repair packet will carry.

Source

pub fn encode( &mut self, layout: FlexFecLayout, sources: &[Packet], timestamp: u32, ) -> Result<Packet, FlexFecEncodeError>

Build one parity repair packet protecting exactly sources, stamped with timestamp (the repair stream’s RTP timestamp for the instant it is sent, section 4.2.1).

sources may belong to several streams, up to 15: each gets a CSRC entry and its own SN base block, in order of first appearance. Order within a stream does not matter.

Source

pub fn encode_block( &mut self, protection: FlexFecProtection, block: &[Packet], timestamp: u32, ) -> Vec<Packet>

Protect one block of consecutive packets of one stream with protection, returning its repair packets in sending order (for 2-D, rows first, then columns: section 4.2.2.2).

Returns nothing when block is not exactly FlexFecProtection::block_len consecutive packets of one stream: L and D describe positions from one base sequence number, so a gap would protect the wrong packets.

Source

pub fn retransmit( &mut self, source: &Packet, timestamp: u32, ) -> Result<Packet, FlexFecEncodeError>

Retransmit source on the repair stream (R=1, F=0; section 4.2.2.3): a new RTP header prepended to the source packet, whose version bits become R and F.

Trait Implementations§

Source§

impl Debug for FlexFecEncoder

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.