pub struct UlpfecDecoder { /* private fields */ }Expand description
Recovers lost media packets of one stream from ULPFEC packets.
Feed it every media packet of the protected stream (push_media) and
every FEC payload (push_fec); each call returns the packets it could
rebuild. Recovery is level by level (9.2) and iterated, so one rebuilt packet can complete
another FEC packet’s set.
§Partial recovery
With uneven protection a packet may be rebuilt at level 0 and not beyond. Its length is then
known and longer than what was rebuilt, which is how 9 tells a partial recovery from a full
one. A partial packet is kept, used as input to further recovery, and not returned: the
octets after the recovered part are unknown, and a packet with a made-up tail is worse than a
lost one. partial_packets counts them.
§Bounds
Media is kept for ULPFEC_MEDIA_WINDOW sequence numbers either side of the newest, FEC
packets up to ULPFEC_MAX_HELD_FEC, and a recovered packet is never longer than the FEC
data received for it.
Implementations§
Source§impl UlpfecDecoder
impl UlpfecDecoder
Sourcepub fn with_one_level_only(self, one_level_only: bool) -> Self
pub fn with_one_level_only(self, one_level_only: bool) -> Self
Refuse FEC packets with more than one protection level, for a stream that signalled
onelevelonly=1 (RFC 5109 13).
Sourcepub fn stats(&self) -> UlpfecDecoderStats
pub fn stats(&self) -> UlpfecDecoderStats
Counters.
Sourcepub fn partial_packets(&self) -> usize
pub fn partial_packets(&self) -> usize
Packets rebuilt at some levels only, and so not handed out.
Sourcepub fn held_fec_packets(&self) -> usize
pub fn held_fec_packets(&self) -> usize
FEC packets held.
Sourcepub fn held_media_packets(&self) -> usize
pub fn held_media_packets(&self) -> usize
Media packets held, complete or partial.
Sourcepub fn push_media(&mut self, packet: &Packet) -> Vec<Packet>
pub fn push_media(&mut self, packet: &Packet) -> Vec<Packet>
A media packet of the protected stream arrived. Returns what it made recoverable.
A packet of another SSRC is ignored.
Sourcepub fn push_fec(&mut self, payload: &[u8]) -> Result<Vec<Packet>, UlpfecError>
pub fn push_fec(&mut self, payload: &[u8]) -> Result<Vec<Packet>, UlpfecError>
A FEC payload arrived: the payload of a FEC packet of a separate stream, or the FEC block of a RED packet. Returns the media packets it made recoverable.
A second copy of a FEC packet already held is ignored.
Rule a of 7.4 is checked against the FEC packets held and counted in
UlpfecDecoderStats::rule_violations, and the packet is used regardless: the recovery
arithmetic does not depend on the rule, and libwebrtc’s masks protect a packet with
several FEC packets whose level-0 lengths differ.