pub struct ProtectionCoverage { /* private fields */ }Expand description
The assignment of media packets to repair packets.
Repair packets are interleaved: with two of them, the first covers media packets 0, 2, 4, … and the second covers 1, 3, 5, …. Interleaving is what makes the scheme tolerate a burst — consecutive losses land in different repair packets, and each can be recovered independently, whereas contiguous blocks would put a burst entirely inside one and recover none of it.
Implementations§
Source§impl ProtectionCoverage
impl ProtectionCoverage
Sourcepub fn new(num_media_packets: u32, num_fec_packets: u32) -> Option<Self>
pub fn new(num_media_packets: u32, num_fec_packets: u32) -> Option<Self>
Assign num_media_packets media packets across num_fec_packets repair packets.
Returns None when the media count is zero or beyond what the masks can describe.
Sourcepub fn update(&mut self, num_media_packets: u32, num_fec_packets: u32)
pub fn update(&mut self, num_media_packets: u32, num_fec_packets: u32)
Recompute the assignment for a new block shape.
A no-op when the shape has not changed, which is the common case: a sender protecting a steady stream keeps the same counts block after block.
Sourcepub fn num_fec_packets(&self) -> u32
pub fn num_fec_packets(&self) -> u32
How many repair packets this covers.
Sourcepub fn num_media_packets(&self) -> u32
pub fn num_media_packets(&self) -> u32
How many media packets this covers.
Sourcepub fn covered_by(&self, fec_index: u32) -> Vec<u32>
pub fn covered_by(&self, fec_index: u32) -> Vec<u32>
The media packet indices that fec_index protects, in order.
Upstream returns a stateful iterator with Reset/First/HasNext, because its encoder
walks the same coverage three times. A plain Vec of indices says the same thing without
the cursor, and the caller can walk it as often as it likes.
Trait Implementations§
Source§impl Clone for ProtectionCoverage
impl Clone for ProtectionCoverage
Source§fn clone(&self) -> ProtectionCoverage
fn clone(&self) -> ProtectionCoverage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more