Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrap around on out of order packet #210

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
#
# This file is auto generated, using git to list all individuals contributors.
# see https://github.com/pion/.goassets/blob/master/scripts/generate-authors.sh for the scripting
Sean DuBois <[email protected]>
ziminghua <[email protected]>
Aaron Boushley <[email protected]>
Adam Kiss <[email protected]>
adamroach <[email protected]>
Aditya Kumar <[email protected]>
Adrian Cable <[email protected]>
aler9 <[email protected]>
Antoine Baché <[email protected]>
Atsushi Watanabe <[email protected]>
Bobby Peck <[email protected]>
boks1971 <[email protected]>
cptpcrd <[email protected]>
David Zhao <[email protected]>
Jonathan Müller <[email protected]>
Kevin Caffrey <[email protected]>
Expand All @@ -27,6 +27,7 @@ Sean DuBois <[email protected]>
Steffen Vogel <[email protected]>
treyhakanson <[email protected]>
XLPolar <[email protected]>
ziminghua <[email protected]>

# List of contributors not appearing in Git history

4 changes: 4 additions & 0 deletions pkg/report/receiver_interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ func TestReceiverInterceptor(t *testing.T) {
SequenceNumber: 0x00,
}})

stream.ReceiveRTP(&rtp.Packet{Header: rtp.Header{
SequenceNumber: 0xfffe,
}})

pkts := <-stream.WrittenRTCP()
assert.Equal(t, len(pkts), 1)
rr, ok := pkts[0].(*rtcp.ReceiverReport)
Expand Down
8 changes: 4 additions & 4 deletions pkg/report/receiver_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ func (stream *receiverStream) processRTP(now time.Time, pktHeader *rtp.Header) {
} else { // following frames
stream.setReceived(pktHeader.SequenceNumber)

diff := int32(pktHeader.SequenceNumber) - int32(stream.lastSeqnum)
if diff > 0 || diff < -0x0FFF {
// overflow
if diff < -0x0FFF {
diff := pktHeader.SequenceNumber - stream.lastSeqnum
if diff > 0 && diff < (1<<15) {
// wrap around
if pktHeader.SequenceNumber < stream.lastSeqnum {
stream.seqnumCycles++
}

Expand Down
Loading