pub struct FlexFec03Encoder { /* private fields */ }Expand description
Builds FlexFEC draft-03 repair packets.
Draft-03 rather than RFC 8627 because draft-03 is what browsers negotiate as
video/flexfec-03. The RFC states its payload formats are not backward compatible with the
earlier drafts, so the two are separate implementations with separate vectors — a draft-03
round trip is evidence about browsers, not about the RFC.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0|0| P|X| CC |M| PT recovery | length recovery |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TS recovery |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SSRCCount | reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SSRC_i |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SN base_i |k| Mask [0-14] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|k| Mask [15-45] (optional) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|k| |
+-+ Mask [46-108] (optional) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Implementations§
Source§impl FlexFec03Encoder
impl FlexFec03Encoder
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.
The repair stream has its own SSRC and its own sequence-number space, both negotiated separately from the media it protects.
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.
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,
media_packets: &[Packet],
num_fec_packets: u32,
) -> Vec<Packet>
pub fn encode( &mut self, media_packets: &[Packet], num_fec_packets: u32, ) -> Vec<Packet>
Build up to num_fec_packets repair packets protecting media_packets.
Returns nothing when the media packets are not a consecutive run: a packet mask describes positions relative to one base sequence number, so a gap would silently shift every position after it and protect the wrong packets. A caller that has lost a packet should start a new block rather than encode across the hole.