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
impl FlexFec03Decoder
Sourcepub fn new(repair_ssrc: u32, media_ssrc: u32) -> Self
pub fn new(repair_ssrc: u32, media_ssrc: u32) -> Self
A decoder for media_ssrc, protected by the repair stream on repair_ssrc.
Sourcepub fn decode(&mut self, packet: Packet) -> Vec<Packet>
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.
Sourcepub fn recovered_len(&self) -> usize
pub fn recovered_len(&self) -> usize
Media packets currently held, whether received or recovered.
Sourcepub fn pending_repair_packets(&self) -> usize
pub fn pending_repair_packets(&self) -> usize
Repair packets currently held while waiting for the media they protect.