Flush sequencer on stream restart; bound frame-integrity loops (#4760)
Flush the downtrack sequencer on stream restart (Resync, ReceiverRestart, codec change) so NACK retransmissions can't use metadata that no longer matches the resynced bucket. Add a defensive bounds guard on the RTX and forward payload slicing. Cap the PacketHistory and FrameIntegrityChecker catch-up loops to the ring size so a large sequence/frame-number jump can't drive a big per-packet iteration count. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
dbe06aa8d1
commit
68ecd38c00
@@ -148,6 +148,26 @@ func (s *sequencer) setRTT(rtt uint32) {
|
||||
}
|
||||
}
|
||||
|
||||
// flush discards all recorded packet metadata. It must be called on a stream restart: the
|
||||
// metadata maps outgoing sequence numbers to source packets in the receiver's bucket, and a
|
||||
// restart resyncs that bucket, so retransmitting against stale metadata would send the wrong
|
||||
// packet (or read past the re-read payload). After flush, NACKs for pre-restart packets are
|
||||
// ignored until the sequencer is re-initialized by the next push.
|
||||
func (s *sequencer) flush() {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
s.initialized = false
|
||||
s.extStartSN = 0
|
||||
s.extHighestSN = 0
|
||||
s.extHighestTS = 0
|
||||
s.snOffset = 0
|
||||
clear(s.meta)
|
||||
if s.snRangeMap != nil {
|
||||
s.snRangeMap = utils.NewRangeMap[uint64, uint64]((s.size + 1) / 2)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *sequencer) push(
|
||||
packetTime int64,
|
||||
extIncomingSN, extModifiedSN uint64,
|
||||
|
||||
Reference in New Issue
Block a user