Skip to content

Commit

Permalink
Removes duplicated unwrapper code
Browse files Browse the repository at this point in the history
  • Loading branch information
mengelbart committed Jan 16, 2025
1 parent 1fb32cc commit 73d958b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 102 deletions.
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.

0 comments on commit 73d958b

Please sign in to comment.