Skip to main content

sequence_is_newer

Function sequence_is_newer 

Source
pub fn sequence_is_newer(candidate: u16, current: u16) -> bool
Expand description

Compare two sequence numbers across the 16-bit wrap.

The counter wraps every ~22 minutes at 50 packets per second, so this is an ordinary event in any call worth having, not an edge case. Comparing with < instead treats the wrap as a 65535-packet jump backwards and throws away a minute of audio while the buffer resyncs.