pub struct SourceSequence { /* private fields */ }Expand description
The per-source sequence number state of RFC 3550 Appendix A.1 (init_seq, update_seq),
with the loss arithmetic of Appendix A.3.
A new source is on probation until MIN_SEQUENTIAL packets arrive in sequence; a jump of
MAX_DROPOUT or more ahead, or more than MAX_MISORDER behind, is taken for a source
that restarted once two packets in a row say so, and the state starts over from there.
Implementations§
Source§impl SourceSequence
impl SourceSequence
Sourcepub fn new(first_sequence_number: u16) -> Self
pub fn new(first_sequence_number: u16) -> Self
The state for a source whose first packet has this sequence number. That packet is
counted by the first update, not here.
Sourcepub fn update(&mut self, sequence_number: u16) -> bool
pub fn update(&mut self, sequence_number: u16) -> bool
Takes a packet’s sequence number. true when the packet is valid: in sequence for a
source past its probation, late or duplicated within MAX_MISORDER. false while the
source is on probation, and for a packet after a jump until the next one confirms it.
Sourcepub fn on_probation(&self) -> bool
pub fn on_probation(&self) -> bool
Whether the source is still on probation.
Sourcepub fn extended_max(&self) -> u32
pub fn extended_max(&self) -> u32
The extended highest sequence number: the count of sequence number cycles in the high 16 bits (RFC 3550 section 6.4.1).
Sourcepub fn expected(&self) -> u32
pub fn expected(&self) -> u32
Packets expected: from the first sequence number to the highest (Appendix A.3).
Sourcepub fn cumulative_lost(&self) -> i64
pub fn cumulative_lost(&self) -> i64
Packets lost: expected less received. Negative when duplicates arrived; a late packet is not lost (RFC 3550 section 6.4.1, Appendix A.3).