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
impl FlexFecEncoder
Sourcepub fn new(payload_type: u8, ssrc: u32) -> Self
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.
Sourcepub fn with_base_sequence_number(self, sequence_number: u16) -> Self
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.
Sourcepub fn next_sequence_number(&self) -> u16
pub fn next_sequence_number(&self) -> u16
The sequence number the next repair packet will carry.
Sourcepub fn encode(
&mut self,
layout: FlexFecLayout,
sources: &[Packet],
timestamp: u32,
) -> Result<Packet, FlexFecEncodeError>
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.
Sourcepub fn encode_block(
&mut self,
protection: FlexFecProtection,
block: &[Packet],
timestamp: u32,
) -> Vec<Packet>
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.
Sourcepub fn retransmit(
&mut self,
source: &Packet,
timestamp: u32,
) -> Result<Packet, FlexFecEncodeError>
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.