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

Deduplicate unwrapper #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions internal/sequencenumber/unwrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ func TestUnwrapper(t *testing.T) {
input: []uint16{32767, 0},
expected: []int64{32767, 0},
},
{
input: []uint16{0, 1, 4, 3, 2, 5},
expected: []int64{0, 1, 4, 3, 2, 5},
},
{
input: []uint16{65534, 0, 1, 65535, 4, 3, 2, 5},
expected: []int64{65534, 65536, 65537, 65535, 65540, 65539, 65538, 65541},
},
{
input: []uint16{
0, 32767, 32768, 32769, 32770,
Expand Down
7 changes: 4 additions & 3 deletions pkg/rfc8888/stream_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ package rfc8888
import (
"time"

"github.com/pion/interceptor/internal/sequencenumber"
"github.com/pion/rtcp"
)

const maxReportsPerReportBlock = 16384

type streamLog struct {
ssrc uint32
sequence unwrapper
sequence sequencenumber.Unwrapper
init bool
nextSequenceNumberToReport int64 // next to report
lastSequenceNumberReceived int64 // highest received
Expand All @@ -23,7 +24,7 @@ type streamLog struct {
func newStreamLog(ssrc uint32) *streamLog {
return &streamLog{
ssrc: ssrc,
sequence: unwrapper{},
sequence: sequencenumber.Unwrapper{},
init: false,
nextSequenceNumberToReport: 0,
lastSequenceNumberReceived: 0,
Expand All @@ -32,7 +33,7 @@ func newStreamLog(ssrc uint32) *streamLog {
}

func (l *streamLog) add(ts time.Time, sequenceNumber uint16, ecn uint8) {
unwrappedSequenceNumber := l.sequence.unwrap(sequenceNumber)
unwrappedSequenceNumber := l.sequence.Unwrap(sequenceNumber)
if !l.init {
l.init = true
l.nextSequenceNumberToReport = unwrappedSequenceNumber
Expand Down
42 changes: 0 additions & 42 deletions pkg/rfc8888/unwrapper.go

This file was deleted.

57 changes: 0 additions & 57 deletions pkg/rfc8888/unwrapper_test.go

This file was deleted.

Loading