Skip to content

Commit

Permalink
fix out of order check
Browse files Browse the repository at this point in the history
A sequence like
66533 -> 0 -> 65534
would have been detected as in-order as 65534 - 0 > 0.
  • Loading branch information
boks1971 committed Nov 1, 2023
1 parent 0440a7d commit 171c72f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/report/sender_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func (stream *senderStream) processRTP(now time.Time, header *rtp.Header, payloa
stream.m.Lock()
defer stream.m.Unlock()

if stream.useLatestPacket || stream.packetCount == 0 || int16(header.SequenceNumber-stream.lastRTPSN) > 0 {
diff := header.SequenceNumber - stream.lastRTPSN
if stream.useLatestPacket || stream.packetCount == 0 || (diff > 0 && diff < (1<<15)) {
// Told to consider every packet, or this was the first packet, or it's in-order
stream.lastRTPSN = header.SequenceNumber
stream.lastRTPTimeRTP = header.Timestamp
Expand Down

0 comments on commit 171c72f

Please sign in to comment.