diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a997d0a2..e8bb22e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go: ["1.18", "1.19"] + go: ["1.17", "1.18", "1.19"] steps: - uses: actions/checkout@v2 diff --git a/pkg/codecs/h264/annexb_test.go b/pkg/codecs/h264/annexb_test.go index 1d362e6c..ae9030c5 100644 --- a/pkg/codecs/h264/annexb_test.go +++ b/pkg/codecs/h264/annexb_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h264 import ( diff --git a/pkg/codecs/h264/avcc_test.go b/pkg/codecs/h264/avcc_test.go index a6874dcb..8d44337c 100644 --- a/pkg/codecs/h264/avcc_test.go +++ b/pkg/codecs/h264/avcc_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h264 import ( diff --git a/pkg/codecs/h264/dtsextractor_test.go b/pkg/codecs/h264/dtsextractor_test.go index b6c89bff..89784fb1 100644 --- a/pkg/codecs/h264/dtsextractor_test.go +++ b/pkg/codecs/h264/dtsextractor_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h264 import ( diff --git a/pkg/codecs/h264/emulationprevention_test.go b/pkg/codecs/h264/emulationprevention_test.go index 323dd84c..bd54ded6 100644 --- a/pkg/codecs/h264/emulationprevention_test.go +++ b/pkg/codecs/h264/emulationprevention_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h264 import ( diff --git a/pkg/codecs/h264/sps_test.go b/pkg/codecs/h264/sps_test.go index 9481dde4..0f47e657 100644 --- a/pkg/codecs/h264/sps_test.go +++ b/pkg/codecs/h264/sps_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h264 import ( diff --git a/pkg/codecs/h265/dtsextractor_test.go b/pkg/codecs/h265/dtsextractor_test.go index 61a19341..bd3e0d24 100644 --- a/pkg/codecs/h265/dtsextractor_test.go +++ b/pkg/codecs/h265/dtsextractor_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h265 import ( diff --git a/pkg/codecs/h265/pps_test.go b/pkg/codecs/h265/pps_test.go index 12c20365..d6de60a3 100644 --- a/pkg/codecs/h265/pps_test.go +++ b/pkg/codecs/h265/pps_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h265 import ( diff --git a/pkg/codecs/h265/sps_test.go b/pkg/codecs/h265/sps_test.go index 22dd4217..570e697b 100644 --- a/pkg/codecs/h265/sps_test.go +++ b/pkg/codecs/h265/sps_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package h265 import ( diff --git a/pkg/codecs/jpeg/define_quantization_table_test.go b/pkg/codecs/jpeg/define_quantization_table_test.go index a9e5e1da..d0810171 100644 --- a/pkg/codecs/jpeg/define_quantization_table_test.go +++ b/pkg/codecs/jpeg/define_quantization_table_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package jpeg import ( diff --git a/pkg/codecs/jpeg/define_restart_interval_test.go b/pkg/codecs/jpeg/define_restart_interval_test.go index abc14c09..35251c8d 100644 --- a/pkg/codecs/jpeg/define_restart_interval_test.go +++ b/pkg/codecs/jpeg/define_restart_interval_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package jpeg import ( diff --git a/pkg/codecs/jpeg/start_of_frame1_test.go b/pkg/codecs/jpeg/start_of_frame1_test.go index fbdca8db..56ff3135 100644 --- a/pkg/codecs/jpeg/start_of_frame1_test.go +++ b/pkg/codecs/jpeg/start_of_frame1_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package jpeg import ( diff --git a/pkg/codecs/jpeg/start_of_scan_test.go b/pkg/codecs/jpeg/start_of_scan_test.go index 52bf16e0..1910ddd2 100644 --- a/pkg/codecs/jpeg/start_of_scan_test.go +++ b/pkg/codecs/jpeg/start_of_scan_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package jpeg import ( diff --git a/pkg/codecs/mpeg4audio/config_test.go b/pkg/codecs/mpeg4audio/config_test.go index b3f73311..d6c01ff3 100644 --- a/pkg/codecs/mpeg4audio/config_test.go +++ b/pkg/codecs/mpeg4audio/config_test.go @@ -1,3 +1,6 @@ +//go:build go1.18 +// +build go1.18 + package mpeg4audio import ( diff --git a/pkg/formatdecenc/rtph264/decoder_test.go b/pkg/formatdecenc/rtph264/decoder_test.go index cbedc820..4c52f978 100644 --- a/pkg/formatdecenc/rtph264/decoder_test.go +++ b/pkg/formatdecenc/rtph264/decoder_test.go @@ -1,282 +1,16 @@ +//go:build go1.18 +// +build go1.18 + package rtph264 import ( "bytes" "testing" - "time" "github.com/pion/rtp" "github.com/stretchr/testify/require" ) -func mergeBytes(vals ...[]byte) []byte { - size := 0 - for _, v := range vals { - size += len(v) - } - res := make([]byte, size) - - pos := 0 - for _, v := range vals { - n := copy(res[pos:], v) - pos += n - } - - return res -} - -var cases = []struct { - name string - nalus [][]byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "single", - [][]byte{ - mergeBytes( - []byte{0x05}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 8), - ), - }, - 25 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289528607, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x05}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 8), - ), - }, - }, - }, - { - "fragmented", - [][]byte{ - mergeBytes( - []byte{0x05}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 512), - ), - }, - 55 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x1c, 0x85}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - []byte{0x00, 0x01}, - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x1c, 0x05}, - []byte{0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 181), - []byte{0x00, 0x01, 0x02, 0x03}, - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x1c, 0x45}, - []byte{0x04, 0x05, 0x06, 0x07}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 147), - ), - }, - }, - }, - { - "aggregated", - [][]byte{ - {0x09, 0xF0}, - { - 0x41, 0x9a, 0x24, 0x6c, 0x41, 0x4f, 0xfe, 0xd6, - 0x8c, 0xb0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x6d, 0x40, - }, - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x18, 0x00, 0x02, 0x09, - 0xf0, 0x00, 0x44, 0x41, 0x9a, 0x24, 0x6c, 0x41, - 0x4f, 0xfe, 0xd6, 0x8c, 0xb0, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x6d, 0x40, - }, - }, - }, - }, - { - "aggregated followed by single", - [][]byte{ - {0x09, 0xF0}, - { - 0x41, 0x9a, 0x24, 0x6c, 0x41, 0x4f, 0xfe, 0xd6, - 0x8c, 0xb0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x6d, 0x40, - }, - mergeBytes( - []byte{0x08}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 175), - ), - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x18, 0x00, 0x02, 0x09, - 0xf0, 0x00, 0x44, 0x41, 0x9a, 0x24, 0x6c, 0x41, - 0x4f, 0xfe, 0xd6, 0x8c, 0xb0, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, - 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x03, 0x00, 0x00, 0x6d, 0x40, - }, - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x08}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 175), - ), - }, - }, - }, - { - "fragmented followed by aggregated", - [][]byte{ - mergeBytes( - []byte{0x05}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 256), - ), - {0x09, 0xF0}, - {0x09, 0xF0}, - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x1c, 0x85}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - []byte{0x00, 0x01}, - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x1c, 0x45}, - []byte{0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 73), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x18, 0x00, 0x02, 0x09, - 0xf0, 0x00, 0x02, 0x09, 0xf0, - }, - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtph264/encoder_test.go b/pkg/formatdecenc/rtph264/encoder_test.go index 70f1388f..81f90b0a 100644 --- a/pkg/formatdecenc/rtph264/encoder_test.go +++ b/pkg/formatdecenc/rtph264/encoder_test.go @@ -1,11 +1,282 @@ package rtph264 import ( + "bytes" "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +func mergeBytes(vals ...[]byte) []byte { + size := 0 + for _, v := range vals { + size += len(v) + } + res := make([]byte, size) + + pos := 0 + for _, v := range vals { + n := copy(res[pos:], v) + pos += n + } + + return res +} + +var cases = []struct { + name string + nalus [][]byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "single", + [][]byte{ + mergeBytes( + []byte{0x05}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 8), + ), + }, + 25 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289528607, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x05}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 8), + ), + }, + }, + }, + { + "fragmented", + [][]byte{ + mergeBytes( + []byte{0x05}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 512), + ), + }, + 55 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x1c, 0x85}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), + []byte{0x00, 0x01}, + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x1c, 0x05}, + []byte{0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 181), + []byte{0x00, 0x01, 0x02, 0x03}, + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x1c, 0x45}, + []byte{0x04, 0x05, 0x06, 0x07}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 147), + ), + }, + }, + }, + { + "aggregated", + [][]byte{ + {0x09, 0xF0}, + { + 0x41, 0x9a, 0x24, 0x6c, 0x41, 0x4f, 0xfe, 0xd6, + 0x8c, 0xb0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x6d, 0x40, + }, + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x18, 0x00, 0x02, 0x09, + 0xf0, 0x00, 0x44, 0x41, 0x9a, 0x24, 0x6c, 0x41, + 0x4f, 0xfe, 0xd6, 0x8c, 0xb0, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x6d, 0x40, + }, + }, + }, + }, + { + "aggregated followed by single", + [][]byte{ + {0x09, 0xF0}, + { + 0x41, 0x9a, 0x24, 0x6c, 0x41, 0x4f, 0xfe, 0xd6, + 0x8c, 0xb0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x6d, 0x40, + }, + mergeBytes( + []byte{0x08}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 175), + ), + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x18, 0x00, 0x02, 0x09, + 0xf0, 0x00, 0x44, 0x41, 0x9a, 0x24, 0x6c, 0x41, + 0x4f, 0xfe, 0xd6, 0x8c, 0xb0, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x6d, 0x40, + }, + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x08}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 175), + ), + }, + }, + }, + { + "fragmented followed by aggregated", + [][]byte{ + mergeBytes( + []byte{0x05}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 256), + ), + {0x09, 0xF0}, + {0x09, 0xF0}, + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x1c, 0x85}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), + []byte{0x00, 0x01}, + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x1c, 0x45}, + []byte{0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 73), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x18, 0x00, 0x02, 0x09, + 0xf0, 0x00, 0x02, 0x09, 0xf0, + }, + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtph265/decoder_test.go b/pkg/formatdecenc/rtph265/decoder_test.go index 497e7f81..300bb0d7 100644 --- a/pkg/formatdecenc/rtph265/decoder_test.go +++ b/pkg/formatdecenc/rtph265/decoder_test.go @@ -1,133 +1,15 @@ +//go:build go1.18 +// +build go1.18 + package rtph265 import ( - "bytes" "testing" - "time" "github.com/pion/rtp" "github.com/stretchr/testify/require" ) -func mergeBytes(vals ...[]byte) []byte { - size := 0 - for _, v := range vals { - size += len(v) - } - res := make([]byte, size) - - pos := 0 - for _, v := range vals { - n := copy(res[pos:], v) - pos += n - } - - return res -} - -var cases = []struct { - name string - nalus [][]byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "single", - [][]byte{{0x01, 0x02, 0x03, 0x04, 0x05}}, - 25 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289528607, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x01, 0x02, 0x03, 0x04, 0x05}, - }, - }, - }, - { - "aggregated", - [][]byte{ - {0x07, 0x07}, - {0x08, 0x08}, - {0x09, 0x09}, - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x60, 0x00, 0x00, 0x02, 0x07, 0x07, 0x00, 0x02, - 0x08, 0x08, 0x00, 0x02, 0x09, 0x09, - }, - }, - }, - }, - { - "fragmented", - [][]byte{ - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 1024), - }, - 55 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x63, 0x02, 0x80, 0x03, 0x04}, - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 363), - []byte{0x01, 0x02, 0x03}, - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x63, 0x02, 0x00, 0x04}, - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x63, 0x02, 0x40}, - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 295), - ), - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtph265/encoder_test.go b/pkg/formatdecenc/rtph265/encoder_test.go index 273159c5..84d1e827 100644 --- a/pkg/formatdecenc/rtph265/encoder_test.go +++ b/pkg/formatdecenc/rtph265/encoder_test.go @@ -1,11 +1,133 @@ package rtph265 import ( + "bytes" "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +func mergeBytes(vals ...[]byte) []byte { + size := 0 + for _, v := range vals { + size += len(v) + } + res := make([]byte, size) + + pos := 0 + for _, v := range vals { + n := copy(res[pos:], v) + pos += n + } + + return res +} + +var cases = []struct { + name string + nalus [][]byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "single", + [][]byte{{0x01, 0x02, 0x03, 0x04, 0x05}}, + 25 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289528607, + SSRC: 0x9dbb7812, + }, + Payload: []byte{0x01, 0x02, 0x03, 0x04, 0x05}, + }, + }, + }, + { + "aggregated", + [][]byte{ + {0x07, 0x07}, + {0x08, 0x08}, + {0x09, 0x09}, + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x60, 0x00, 0x00, 0x02, 0x07, 0x07, 0x00, 0x02, + 0x08, 0x08, 0x00, 0x02, 0x09, 0x09, + }, + }, + }, + }, + { + "fragmented", + [][]byte{ + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 1024), + }, + 55 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x63, 0x02, 0x80, 0x03, 0x04}, + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 363), + []byte{0x01, 0x02, 0x03}, + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x63, 0x02, 0x00, 0x04}, + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x63, 0x02, 0x40}, + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 295), + ), + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtplpcm/decoder_test.go b/pkg/formatdecenc/rtplpcm/decoder_test.go index 7be66e91..e9de58f5 100644 --- a/pkg/formatdecenc/rtplpcm/decoder_test.go +++ b/pkg/formatdecenc/rtplpcm/decoder_test.go @@ -1,7 +1,9 @@ +//go:build go1.18 +// +build go1.18 + package rtplpcm import ( - "bytes" "testing" "time" @@ -9,61 +11,6 @@ import ( "github.com/stretchr/testify/require" ) -var cases = []struct { - name string - samples []byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "single", - []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}, - 25 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527557, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}, - }, - }, - }, - { - "splitted", - bytes.Repeat([]byte{0x41, 0x42, 0x43}, 680), - 25 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527557, - SSRC: 0x9dbb7812, - }, - Payload: bytes.Repeat([]byte{0x41, 0x42, 0x43}, 486), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289527800, - SSRC: 0x9dbb7812, - }, - Payload: bytes.Repeat([]byte{0x41, 0x42, 0x43}, 194), - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtplpcm/encoder_test.go b/pkg/formatdecenc/rtplpcm/encoder_test.go index f2829843..57324400 100644 --- a/pkg/formatdecenc/rtplpcm/encoder_test.go +++ b/pkg/formatdecenc/rtplpcm/encoder_test.go @@ -1,11 +1,69 @@ package rtplpcm import ( + "bytes" "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +var cases = []struct { + name string + samples []byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "single", + []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}, + 25 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527557, + SSRC: 0x9dbb7812, + }, + Payload: []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}, + }, + }, + }, + { + "splitted", + bytes.Repeat([]byte{0x41, 0x42, 0x43}, 680), + 25 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527557, + SSRC: 0x9dbb7812, + }, + Payload: bytes.Repeat([]byte{0x41, 0x42, 0x43}, 486), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289527800, + SSRC: 0x9dbb7812, + }, + Payload: bytes.Repeat([]byte{0x41, 0x42, 0x43}, 194), + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpmjpeg/decoder_test.go b/pkg/formatdecenc/rtpmjpeg/decoder_test.go index 8ef96f52..5c50e617 100644 --- a/pkg/formatdecenc/rtpmjpeg/decoder_test.go +++ b/pkg/formatdecenc/rtpmjpeg/decoder_test.go @@ -1,513 +1,15 @@ +//go:build go1.18 +// +build go1.18 + package rtpmjpeg import ( "testing" - "time" "github.com/pion/rtp" "github.com/stretchr/testify/require" ) -var cases = []struct { - name string - image []byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "base", - []byte{ - 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d, - 0x09, 0x0a, 0x0b, 0x0a, 0x08, 0x0d, 0x0b, 0x0a, - 0x0b, 0x0e, 0x0e, 0x0d, 0x0f, 0x13, 0x20, 0x15, - 0x13, 0x12, 0x12, 0x13, 0x27, 0x1c, 0x1e, 0x17, - 0x20, 0x2e, 0x29, 0x31, 0x30, 0x2e, 0x29, 0x2d, - 0x2c, 0x33, 0x3a, 0x4a, 0x3e, 0x33, 0x36, 0x46, - 0x37, 0x2c, 0x2d, 0x40, 0x57, 0x41, 0x46, 0x4c, - 0x4e, 0x52, 0x53, 0x52, 0x32, 0x3e, 0x5a, 0x61, - 0x5a, 0x50, 0x60, 0x4a, 0x51, 0x52, 0x4f, 0x01, - 0x0e, 0x0e, 0x0e, 0x13, 0x11, 0x13, 0x26, 0x15, - 0x15, 0x26, 0x4f, 0x35, 0x2d, 0x35, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0xff, 0xc0, 0x00, 0x11, 0x08, 0x04, 0x38, 0x07, - 0x80, 0x03, 0x00, 0x22, 0x00, 0x01, 0x11, 0x01, - 0x02, 0x11, 0x01, 0xff, 0xc4, 0x00, 0x1f, 0x00, - 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, - 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, - 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, - 0x7d, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, - 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, - 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, - 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, - 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, - 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, - 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, - 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, - 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, - 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, - 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, - 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, - 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, - 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, - 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, - 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xff, 0xc4, 0x00, 0x1f, 0x01, - 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, - 0x11, 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, - 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, - 0x77, 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, - 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, - 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, - 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, - 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, - 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, - 0x26, 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, - 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, - 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, - 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, - 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, - 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, - 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, - 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, - 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, - 0x00, 0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3f, - 0x00, 0x92, 0x8a, 0x28, 0xaf, 0x54, 0xf2, 0x42, - 0x8a, 0x28, 0xa0, 0x02, 0x96, 0x92, 0x96, 0x80, - 0x0a, 0x4a, 0x75, 0x25, 0x02, 0x12, 0x8a, 0x5a, - 0x28, 0x18, 0x94, 0x52, 0xd1, 0x40, 0x09, 0x45, - 0x2d, 0x14, 0x08, 0x29, 0x69, 0x29, 0x68, 0x00, - 0xa5, 0xa4, 0xa5, 0xa0, 0x02, 0x8a, 0x28, 0xa0, - 0x02, 0x8a, 0x28, 0xa0, 0x04, 0xa5, 0xa2, 0x8a, - 0x00, 0x5a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, - 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x12, 0x8a, 0x5a, - 0x28, 0x24, 0x29, 0x69, 0x29, 0x68, 0x00, 0xa2, - 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, - 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, - 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, - 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, - 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, - 0x8a, 0x28, 0x00, 0xa4, 0xa5, 0xa4, 0xa0, 0x02, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, - 0x96, 0x92, 0x96, 0x80, 0x0a, 0x28, 0xa2, 0x80, - 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, - 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, - 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, - 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x81, - 0x85, 0x14, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, - 0x05, 0x14, 0x51, 0x40, 0x05, 0x14, 0x52, 0xd0, - 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, - 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x2d, 0x14, - 0x00, 0x94, 0xb4, 0x51, 0x40, 0x05, 0x14, 0x52, - 0xd0, 0x02, 0x51, 0x4b, 0x45, 0x00, 0x25, 0x2d, - 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, - 0x14, 0x50, 0x20, 0xa5, 0xa4, 0xa5, 0xa0, 0x02, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, - 0x8a, 0x5a, 0x28, 0x18, 0x94, 0xb4, 0x51, 0x40, - 0xc2, 0x8a, 0x28, 0xa0, 0x05, 0xa2, 0x92, 0x9d, - 0x40, 0x05, 0x14, 0x51, 0x48, 0x02, 0x8a, 0x28, - 0xa4, 0x01, 0x4b, 0x49, 0x4b, 0x40, 0x05, 0x14, - 0x51, 0x40, 0x05, 0x14, 0xb4, 0x50, 0x02, 0x51, - 0x4b, 0x45, 0x00, 0x25, 0x2d, 0x14, 0x50, 0x03, - 0xa8, 0xa2, 0x8a, 0x00, 0x28, 0xa2, 0x8a, 0x00, - 0x5a, 0x29, 0x29, 0x68, 0x00, 0xa2, 0x8a, 0x28, - 0x00, 0xa2, 0x96, 0x8a, 0x06, 0x25, 0x14, 0xb4, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x02, 0xd2, 0xd2, - 0x52, 0xd0, 0x20, 0xa2, 0x8a, 0x28, 0x01, 0x68, - 0xa2, 0x8a, 0x40, 0x14, 0x51, 0x45, 0x30, 0x0a, - 0x5a, 0x4a, 0x5a, 0x06, 0x14, 0x51, 0x45, 0x02, - 0x0a, 0x28, 0xa5, 0xa0, 0x62, 0x51, 0x4b, 0x45, - 0x00, 0x2d, 0x14, 0x51, 0x48, 0x02, 0x8a, 0x28, - 0xa0, 0x61, 0x45, 0x14, 0x50, 0x03, 0xa8, 0xa2, - 0x8a, 0x06, 0x2d, 0x14, 0x51, 0x48, 0x02, 0x8a, - 0x28, 0xa4, 0x30, 0xa2, 0x8a, 0x2a, 0x80, 0x28, - 0xa2, 0x8a, 0x00, 0x28, 0xa2, 0x8a, 0x92, 0x45, - 0xa5, 0xa2, 0x96, 0x82, 0x82, 0x8a, 0x28, 0xa0, - 0x02, 0x8a, 0x28, 0xa0, 0x05, 0xa2, 0x8a, 0x29, - 0x80, 0x52, 0xd2, 0x52, 0xd0, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x4e, 0xa2, 0x8a, 0x43, 0x0a, 0x28, - 0xa2, 0x80, 0x0a, 0x28, 0xa4, 0xa4, 0x31, 0x68, - 0xa4, 0xf3, 0x62, 0xff, 0x00, 0x9e, 0xd1, 0x7e, - 0xea, 0x9f, 0xfe, 0xb6, 0xa4, 0x62, 0x52, 0x53, - 0xa9, 0x28, 0x01, 0x28, 0xa2, 0x6f, 0xdd, 0x7f, - 0xaf, 0xa5, 0xa0, 0x62, 0x51, 0x4b, 0x45, 0x00, - 0x25, 0x14, 0xbf, 0xba, 0xff, 0x00, 0xae, 0xb4, - 0xea, 0x60, 0x36, 0x9d, 0x49, 0x49, 0x34, 0xb1, - 0x45, 0xfe, 0xbe, 0x6f, 0x2a, 0x98, 0x0f, 0xa2, - 0xb9, 0xbd, 0x0f, 0x59, 0x97, 0x54, 0xf1, 0x2d, - 0xd7, 0xfc, 0xf9, 0xd7, 0x49, 0x52, 0x30, 0xac, - 0x7d, 0x5b, 0x54, 0xd5, 0x74, 0xbf, 0xdf, 0x41, - 0x67, 0x15, 0xd4, 0x35, 0x63, 0x56, 0xd5, 0x22, - 0xd2, 0xe0, 0xf3, 0xbc, 0x99, 0x65, 0xae, 0x4b, - 0x51, 0xf1, 0x44, 0x52, 0xff, 0x00, 0xc7, 0x97, - 0x9b, 0xe4, 0xd0, 0x69, 0x4c, 0x76, 0xa3, 0xe2, - 0xd9, 0xa5, 0x82, 0x29, 0xb4, 0xbf, 0xdd, 0x79, - 0xbf, 0xeb, 0x22, 0xaa, 0x7e, 0x1e, 0xd5, 0x3e, - 0xc1, 0x3f, 0xfa, 0x9f, 0xfa, 0xe9, 0x25, 0x61, - 0xd6, 0x9e, 0x87, 0xf6, 0xbf, 0xed, 0x68, 0xbc, - 0x8a, 0x82, 0xcf, 0x4e, 0x86, 0x5f, 0x36, 0x0a, - 0x92, 0x9b, 0xff, 0x00, 0x5d, 0xeb, 0x3a, 0x6d, - 0x53, 0xfd, 0x3f, 0xec, 0x76, 0x3f, 0xbd, 0xff, - 0x00, 0xa6, 0xbf, 0xc1, 0x54, 0x66, 0x69, 0x51, - 0x50, 0x4b, 0x2c, 0x51, 0x7e, 0xe7, 0xce, 0xf3, - 0x66, 0xff, 0x00, 0xa6, 0x75, 0x35, 0x00, 0x2d, - 0x65, 0x6a, 0xde, 0x23, 0xd3, 0xec, 0x3f, 0xe5, - 0xb7, 0x9b, 0x34, 0x5f, 0xf2, 0xce, 0xb4, 0x7e, - 0xd5, 0x69, 0x2f, 0xfc, 0xbe, 0x45, 0x5e, 0x7b, - 0xe2, 0x7d, 0x07, 0xec, 0x1e, 0x6e, 0xa5, 0xf6, - 0xc8, 0xa5, 0xf3, 0x6a, 0xc0, 0xdf, 0xa2, 0x9d, - 0x45, 0x6c, 0x72, 0x0d, 0xa5, 0xa5, 0xa2, 0x80, - 0x12, 0x96, 0x8a, 0x28, 0x10, 0x51, 0x4b, 0x45, - 0x00, 0x25, 0x14, 0xb4, 0x50, 0x02, 0x51, 0x4b, - 0x45, 0x03, 0x12, 0x8a, 0x5a, 0x28, 0x10, 0x94, - 0xb4, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, 0x05, - 0x14, 0xb4, 0x50, 0x02, 0x51, 0x4b, 0x45, 0x00, - 0x14, 0x51, 0x4b, 0x40, 0x84, 0xa2, 0x8a, 0x28, - 0x00, 0xa2, 0x96, 0x8a, 0x00, 0x4a, 0x29, 0x68, - 0xa0, 0x04, 0xa2, 0x96, 0x8a, 0x00, 0x4a, 0x29, - 0x68, 0xa0, 0x41, 0x45, 0x14, 0x50, 0x01, 0x45, - 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, - 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, - 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, - 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, - 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x49, - 0x4b, 0x45, 0x00, 0x25, 0x14, 0xb4, 0x50, 0x01, - 0x45, 0x14, 0x50, 0x30, 0xa4, 0xa5, 0xa2, 0x81, - 0x09, 0x45, 0x2d, 0x14, 0x00, 0x94, 0x52, 0xd1, - 0x40, 0x09, 0x45, 0x2d, 0x14, 0x00, 0x94, 0x52, - 0xd1, 0x40, 0x05, 0x14, 0xb4, 0x94, 0x0c, 0x28, - 0xa2, 0x8a, 0x04, 0x14, 0x51, 0x45, 0x00, 0x14, - 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, - 0x51, 0x45, 0x00, 0x14, 0x52, 0xd1, 0x40, 0xc4, - 0xa2, 0x96, 0x8a, 0x04, 0x25, 0x14, 0xb4, 0x50, - 0x31, 0x28, 0xa5, 0xa2, 0x80, 0x12, 0x8a, 0x5a, - 0x4a, 0x00, 0x5a, 0x28, 0xa2, 0x80, 0x0a, 0x29, - 0x68, 0xa0, 0x04, 0xa2, 0x96, 0x8a, 0x00, 0x4a, - 0x29, 0x68, 0xa0, 0x04, 0xa2, 0x9d, 0x45, 0x03, - 0x1b, 0x45, 0x3a, 0x8a, 0x00, 0x6d, 0x14, 0xea, - 0x28, 0x10, 0x94, 0x52, 0xd1, 0x40, 0x09, 0x4b, - 0x45, 0x14, 0x08, 0x28, 0xa2, 0x8a, 0x06, 0x14, - 0x52, 0xd1, 0x40, 0x09, 0x45, 0x2d, 0x2d, 0x00, - 0x25, 0x14, 0xb4, 0x50, 0x21, 0x28, 0xa5, 0xa2, - 0x81, 0x89, 0x4b, 0x45, 0x14, 0x00, 0x51, 0x45, - 0x14, 0x00, 0x51, 0x4b, 0x45, 0x00, 0x25, 0x14, - 0xb4, 0x50, 0x01, 0x45, 0x2d, 0x14, 0x0c, 0x28, - 0xa2, 0x8a, 0x00, 0x4a, 0x5a, 0x5a, 0x28, 0x01, - 0x28, 0xa5, 0xa2, 0x90, 0x05, 0x14, 0x51, 0x40, - 0x05, 0x14, 0xb4, 0x52, 0x01, 0x28, 0xa5, 0xa2, - 0x80, 0x0a, 0x28, 0xa7, 0x50, 0x03, 0x68, 0xa7, - 0x51, 0x40, 0x0d, 0xa7, 0x51, 0x45, 0x00, 0x14, - 0x51, 0x4b, 0x40, 0x09, 0x45, 0x2d, 0x2d, 0x00, - 0x25, 0x14, 0xb4, 0x50, 0x02, 0x51, 0x4b, 0x45, - 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, - 0x00, 0x14, 0xb4, 0x53, 0xa8, 0x18, 0xda, 0x5a, - 0x5a, 0x28, 0x10, 0x94, 0xb4, 0x51, 0x40, 0xc2, - 0x8a, 0x5a, 0x29, 0x00, 0x94, 0x52, 0xd1, 0x40, - 0x05, 0x14, 0x51, 0x4c, 0x02, 0x96, 0x8a, 0x29, - 0x00, 0x52, 0xd2, 0x52, 0xd0, 0x01, 0x45, 0x14, - 0x50, 0x02, 0xd1, 0x45, 0x14, 0x0c, 0x28, 0xa2, - 0x96, 0x80, 0x0a, 0x28, 0xa2, 0x81, 0x85, 0x2d, - 0x14, 0x50, 0x01, 0x45, 0x14, 0xb4, 0x80, 0x4a, - 0x29, 0x68, 0xa0, 0x62, 0xd1, 0x45, 0x14, 0xc0, - 0x28, 0xa5, 0xa2, 0x90, 0x0d, 0xa5, 0xa5, 0xa2, - 0x80, 0x0a, 0x5a, 0x28, 0xa4, 0x01, 0x45, 0x14, - 0xb4, 0x00, 0x94, 0x52, 0xd1, 0x40, 0x05, 0x14, - 0x51, 0x4c, 0x02, 0x8a, 0x29, 0x68, 0x01, 0x28, - 0xa5, 0xa2, 0x80, 0x16, 0x8a, 0x28, 0xa4, 0x30, - 0xa7, 0x55, 0x7b, 0xbb, 0x5f, 0xb7, 0xc1, 0xe4, - 0xff, 0x00, 0xaa, 0xac, 0x49, 0xb4, 0x6d, 0x57, - 0x4b, 0xf3, 0x66, 0xd2, 0xef, 0x3c, 0xd8, 0x69, - 0x17, 0x4c, 0xe9, 0x2b, 0x07, 0xc4, 0x32, 0xcb, - 0x75, 0xa4, 0xff, 0x00, 0xc4, 0xae, 0x68, 0xbf, - 0x75, 0xfe, 0xb2, 0xb9, 0x09, 0xb5, 0x9d, 0x42, - 0x5f, 0x36, 0xcf, 0xce, 0xff, 0x00, 0x5b, 0x56, - 0x3c, 0x3d, 0x6b, 0xfd, 0xa9, 0xab, 0x4b, 0x67, - 0x3f, 0xfc, 0xf3, 0xff, 0x00, 0x96, 0x74, 0x8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 0xdd, 0x7d, 0xab, 0x5e, 0xfb, 0x1d, 0x8c, - 0xde, 0x55, 0x9c, 0xb2, 0x79, 0x95, 0xd3, 0x6a, - 0x3a, 0xa7, 0xd9, 0x75, 0xdb, 0x5b, 0x39, 0xff, - 0x00, 0xd4, 0xcb, 0xff, 0x00, 0x2d, 0x2b, 0xcf, - 0xbe, 0xdf, 0xe5, 0x6a, 0xdf, 0x6c, 0x83, 0xfe, - 0x59, 0x54, 0xda, 0xb6, 0xb3, 0x2e, 0xb3, 0x7f, - 0xe7, 0x7f, 0xaa, 0xff, 0xff, 0xd9, - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 26, - SequenceNumber: 17645, - Timestamp: 2289528607, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xf0, 0x87, - 0x00, 0x00, 0x00, 0x80, 0x0d, 0x09, 0x0a, 0x0b, - 0x0a, 0x08, 0x0d, 0x0b, 0x0a, 0x0b, 0x0e, 0x0e, - 0x0d, 0x0f, 0x13, 0x20, 0x15, 0x13, 0x12, 0x12, - 0x13, 0x27, 0x1c, 0x1e, 0x17, 0x20, 0x2e, 0x29, - 0x31, 0x30, 0x2e, 0x29, 0x2d, 0x2c, 0x33, 0x3a, - 0x4a, 0x3e, 0x33, 0x36, 0x46, 0x37, 0x2c, 0x2d, - 0x40, 0x57, 0x41, 0x46, 0x4c, 0x4e, 0x52, 0x53, - 0x52, 0x32, 0x3e, 0x5a, 0x61, 0x5a, 0x50, 0x60, - 0x4a, 0x51, 0x52, 0x4f, 0x0e, 0x0e, 0x0e, 0x13, - 0x11, 0x13, 0x26, 0x15, 0x15, 0x26, 0x4f, 0x35, - 0x2d, 0x35, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x92, 0x8a, 0x28, 0xaf, - 0x54, 0xf2, 0x42, 0x8a, 0x28, 0xa0, 0x02, 0x96, - 0x92, 0x96, 0x80, 0x0a, 0x4a, 0x75, 0x25, 0x02, - 0x12, 0x8a, 0x5a, 0x28, 0x18, 0x94, 0x52, 0xd1, - 0x40, 0x09, 0x45, 0x2d, 0x14, 0x08, 0x29, 0x69, - 0x29, 0x68, 0x00, 0xa5, 0xa4, 0xa5, 0xa0, 0x02, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x04, - 0xa5, 0xa2, 0x8a, 0x00, 0x5a, 0x28, 0xa2, 0x80, - 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, - 0x12, 0x8a, 0x5a, 0x28, 0x24, 0x29, 0x69, 0x29, - 0x68, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, - 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, - 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, - 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, - 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, - 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa4, 0xa5, - 0xa4, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, - 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, - 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, - 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, - 0x28, 0xa0, 0x02, 0x96, 0x92, 0x96, 0x80, 0x0a, - 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, - 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, - 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, - 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, - 0x28, 0xa2, 0x81, 0x85, 0x14, 0x51, 0x40, 0x05, - 0x14, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, 0x05, - 0x14, 0x52, 0xd0, 0x01, 0x45, 0x14, 0x50, 0x01, - 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, - 0x45, 0x2d, 0x14, 0x00, 0x94, 0xb4, 0x51, 0x40, - 0x05, 0x14, 0x52, 0xd0, 0x02, 0x51, 0x4b, 0x45, - 0x00, 0x25, 0x2d, 0x14, 0x50, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x20, 0xa5, 0xa4, - 0xa5, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, - 0x28, 0xa0, 0x02, 0x8a, 0x5a, 0x28, 0x18, 0x94, - 0xb4, 0x51, 0x40, 0xc2, 0x8a, 0x28, 0xa0, 0x05, - 0xa2, 0x92, 0x9d, 0x40, 0x05, 0x14, 0x51, 0x48, - 0x02, 0x8a, 0x28, 0xa4, 0x01, 0x4b, 0x49, 0x4b, - 0x40, 0x05, 0x14, 0x51, 0x40, 0x05, 0x14, 0xb4, - 0x50, 0x02, 0x51, 0x4b, 0x45, 0x00, 0x25, 0x2d, - 0x14, 0x50, 0x03, 0xa8, 0xa2, 0x8a, 0x00, 0x28, - 0xa2, 0x8a, 0x00, 0x5a, 0x29, 0x29, 0x68, 0x00, - 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x96, 0x8a, 0x06, - 0x25, 0x14, 0xb4, 0x50, 0x01, 0x45, 0x14, 0x50, - 0x02, 0xd2, 0xd2, 0x52, 0xd0, 0x20, 0xa2, 0x8a, - 0x28, 0x01, 0x68, 0xa2, 0x8a, 0x40, 0x14, 0x51, - 0x45, 0x30, 0x0a, 0x5a, 0x4a, 0x5a, 0x06, 0x14, - 0x51, 0x45, 0x02, 0x0a, 0x28, 0xa5, 0xa0, 0x62, - 0x51, 0x4b, 0x45, 0x00, 0x2d, 0x14, 0x51, 0x48, - 0x02, 0x8a, 0x28, 0xa0, 0x61, 0x45, 0x14, 0x50, - 0x03, 0xa8, 0xa2, 0x8a, 0x06, 0x2d, 0x14, 0x51, - 0x48, 0x02, 0x8a, 0x28, 0xa4, 0x30, 0xa2, 0x8a, - 0x2a, 0x80, 0x28, 0xa2, 0x8a, 0x00, 0x28, 0xa2, - 0x8a, 0x92, 0x45, 0xa5, 0xa2, 0x96, 0x82, 0x82, - 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x05, - 0xa2, 0x8a, 0x29, 0x80, 0x52, 0xd2, 0x52, 0xd0, - 0x01, 0x45, 0x14, 0x50, 0x01, 0x4e, 0xa2, 0x8a, - 0x43, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa4, - 0xa4, 0x31, 0x68, 0xa4, 0xf3, 0x62, 0xff, 0x00, - 0x9e, 0xd1, 0x7e, 0xea, 0x9f, 0xfe, 0xb6, 0xa4, - 0x62, 0x52, 0x53, 0xa9, 0x28, 0x01, 0x28, 0xa2, - 0x6f, 0xdd, 0x7f, 0xaf, 0xa5, 0xa0, 0x62, 0x51, - 0x4b, 0x45, 0x00, 0x25, 0x14, 0xbf, 0xba, 0xff, - 0x00, 0xae, 0xb4, 0xea, 0x60, 0x36, 0x9d, 0x49, - 0x49, 0x34, 0xb1, 0x45, 0xfe, 0xbe, 0x6f, 0x2a, - 0x98, 0x0f, 0xa2, 0xb9,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 0xa5, - 0xa5, 0xa2, 0x80, 0x12, 0x96, 0x8a, 0x28, 0x10, - 0x51, 0x4b, 0x45, 0x00, 0x25, 0x14, 0xb4, 0x50, - 0x02, 0x51, 0x4b, 0x45, 0x03, 0x12, 0x8a, 0x5a, - 0x28, 0x10, 0x94, 0xb4, 0x51, 0x40, 0x05, 0x14, - 0x51, 0x40, 0x05, 0x14, 0xb4, 0x50, 0x02, 0x51, - 0x4b, 0x45, 0x00, 0x14, 0x51, 0x4b, 0x40, 0x84, - 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x96, 0x8a, 0x00, - 0x4a, 0x29, 0x68, 0xa0, 0x04, 0xa2, 0x96, 0x8a, - 0x00, 0x4a, 0x29, 0x68, 0xa0, 0x41, 0x45, 0x14, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, - 0x50, 0x01, 0x49, 0x4b, 0x45, 0x00, 0x25, 0x14, - 0xb4, 0x50, 0x01, 0x45, 0x14, 0x50, 0x30, 0xa4, - 0xa5, 0xa2, 0x81, 0x09, 0x45, 0x2d, 0x14, 0x00, - 0x94, 0x52, 0xd1, 0x40, 0x09, 0x45, 0x2d, 0x14, - 0x00, 0x94, 0x52, 0xd1, 0x40, 0x05, 0x14, 0xb4, - 0x94, 0x0c, 0x28, 0xa2, 0x8a, 0x04, 0x14, 0x51, - 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, - 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x52, - 0xd1, 0x40, 0xc4, 0xa2, 0x96, 0x8a, 0x04, 0x25, - 0x14, 0xb4, 0x50, 0x31, 0x28, 0xa5, 0xa2, 0x80, - 0x12, 0x8a, 0x5a, 0x4a, 0x00, 0x5a, 0x28, 0xa2, - 0x80, 0x0a, 0x29, 0x68, 0xa0, 0x04, 0xa2, 0x96, - 0x8a, 0x00, 0x4a, 0x29, 0x68, 0xa0, 0x04, 0xa2, - 0x9d, 0x45, 0x03, 0x1b, 0x45, 0x3a, 0x8a, 0x00, - 0x6d, 0x14, 0xea, 0x28, 0x10, 0x94, 0x52, 0xd1, - 0x40, 0x09, 0x4b, 0x45, 0x14, 0x08, 0x28, 0xa2, - 0x8a, 0x06, 0x14, 0x52, 0xd1, 0x40, 0x09, 0x45, - 0x2d, 0x2d, 0x00, 0x25, 0x14, 0xb4, 0x50, 0x21, - 0x28, 0xa5, 0xa2, 0x81, 0x89, 0x4b, 0x45, 0x14, - 0x00, 0x51, 0x45, 0x14, 0x00, 0x51, 0x4b, 0x45, - 0x00, 0x25, 0x14, 0xb4, 0x50, 0x01, 0x45, 0x2d, - 0x14, 0x0c, 0x28, 0xa2, 0x8a, 0x00, 0x4a, 0x5a, - 0x5a, 0x28, 0x01, 0x28, 0xa5, 0xa2, 0x90, 0x05, - 0x14, 0x51, 0x40, 0x05, 0x14, 0xb4, 0x52, 0x01, - 0x28, 0xa5, 0xa2, 0x80, 0x0a, 0x28, 0xa7, 0x50, - 0x03, 0x68, 0xa7, 0x51, 0x40, 0x0d, 0xa7, 0x51, - 0x45, 0x00, 0x14, 0x51, 0x4b, 0x40, 0x09, 0x45, - 0x2d, 0x2d, 0x00, 0x25, 0x14, 0xb4, 0x50, 0x02, - 0x51, 0x4b, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, - 0x14, 0x51, 0x45, 0x00, 0x14, 0xb4, 0x53, 0xa8, - 0x18, 0xda, 0x5a, 0x5a, 0x28, 0x10, 0x94, 0xb4, - 0x51, 0x40, 0xc2, 0x8a, 0x5a, 0x29, 0x00, 0x94, - 0x52, 0xd1, 0x40, 0x05, 0x14, 0x51, 0x4c, 0x02, - 0x96, 0x8a, 0x29, 0x00, 0x52, 0xd2, 0x52, 0xd0, - 0x01, 0x45, 0x14, 0x50, 0x02, 0xd1, 0x45, 0x14, - 0x0c, 0x28, 0xa2, 0x96, 0x80, 0x0a, 0x28, 0xa2, - 0x81, 0x85, 0x2d, 0x14, 0x50, 0x01, 0x45, 0x14, - 0xb4, 0x80, 0x4a, 0x29, 0x68, 0xa0, 0x62, 0xd1, - 0x45, 0x14, 0xc0, 0x28, 0xa5, 0xa2, 0x90, 0x0d, - 0xa5, 0xa5, 0xa2, 0x80, 0x0a, 0x5a, 0x28, 0xa4, - 0x01, 0x45, 0x14, 0xb4, 0x00, 0x94, 0x52, 0xd1, - 0x40, 0x05, 0x14, 0x51, 0x4c, 0x02, 0x8a, 0x29, - 0x68, 0x01, 0x28, 0xa5, 0xa2, 0x80, 0x16, 0x8a, - 0x28, 0xa4, 0x30, 0xa7, 0x55, 0x7b, 0xbb, 0x5f, - 0xb7, 0xc1, 0xe4, 0xff, 0x00, 0xaa, 0xac, 0x49, - 0xb4, 0x6d, 0x57, 0x4b, 0xf3, 0x66, 0xd2, 0xef, - 0x3c, 0xd8, 0x69, 0x17, 0x4c, 0xe9, 0x2b, 0x07, - 0xc4, 0x32, 0xcb, 0x75, 0xa4, 0xff, 0x00, 0xc4, - 0xae, 0x68, 0xbf, 0x75, 0xfe, 0xb2, 0xb9, 0x09, - 0xb5, 0x9d, 0x42, 0x5f, 0x36, 0xcf, 0xce, 0xff, - 0x00, 0x5b, 0x56, 0x3c, 0x3d, 0x6b, 0xfd, 0xa9, - 0xab, 0x4b, 0x67, 0x3f, 0xfc, 0xf3, 0xff, 0x00, - 0x96, 0x74, 0x8d, 0xbd, 0x99, 0x9b, 0x0d, 0xfc, - 0xb2, 0xf9, 0xbf, 0xeb, 0x7f, 0x7b, 0x5a, 0xf0, - 0xf8, 0x8e, 0xee, 0x2d, 0x27, 0xec, 0x70, 0x7f, - 0xdf, 0xca, 0x66, 0xa3, 0xe1, 0x7f, 0xb0, 0x79, - 0xbe, 0x46, 0xa5, 0x17, 0xfd, 0x73, 0x92, 0xb0, - 0xe1, 0xa8, 0x0f, 0x66, 0x76, 0x90, 0xf8, 0xa2, - 0x29, 0x6c, 0x3c, 0x9f, 0xde, 0xf9, 0xde, 0x5f, - 0xef, 0x24, 0xaa, 0x76, 0x9e, 0x2d, 0xbb, 0x8b, - 0x49, 0xf2, 0x7f, 0xe5, 0xb5, 0x62, 0x5a, 0x5f, - 0xcb, 0x6b, 0xfe, 0xa3, 0xfe, 0x5a, 0xd1, 0xe5, - 0x45, 0xff, 0x00, 0x2c, 0x29, 0x0f, 0xd9, 0x97, - 0xff, 0x00, 0xb6, 0x65, - }, - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 26, - SequenceNumber: 17646, - Timestamp: 2289528607, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x00, 0x00, 0x05, 0x28, 0x01, 0xff, 0xf0, 0x87, - 0xba, 0x82, 0x5f, 0xb7, 0x4d, 0xe6, 0xcd, 0xff, - 0x00, 0x2c, 0xe2, 0xae, 0xa7, 0x49, 0xd5, 0x3f, - 0xe2, 0x9a, 0xf3, 0xa7, 0xff, 0x00, 0x5d, 0x15, - 0x70, 0xb4, 0x43, 0xfb, 0xdf, 0xf5, 0xf3, 0x4b, - 0xff, 0x00, 0x5c, 0xe8, 0xf6, 0x83, 0xf6, 0x67, - 0xa1, 0x68, 0x7a, 0xcc, 0x5a, 0xcf, 0xfd, 0x32, - 0x9b, 0xfe, 0x79, 0xd5, 0xeb, 0xbb, 0xab, 0x4b, - 0x08, 0x3f, 0xd3, 0xab, 0xcd, 0x66, 0xba, 0xfb, - 0x57, 0xfd, 0x32, 0x9a, 0x2a, 0x96, 0xd2, 0xff, - 0x00, 0xcd, 0xbf, 0xf3, 0xb5, 0x49, 0xbc, 0xdf, - 0x2b, 0xfe, 0x59, 0xd3, 0x27, 0xd9, 0x9a, 0x30, - 0xdd, 0x7d, 0xab, 0x5e, 0xfb, 0x1d, 0x8c, 0xde, - 0x55, 0x9c, 0xb2, 0x79, 0x95, 0xd3, 0x6a, 0x3a, - 0xa7, 0xd9, 0x75, 0xdb, 0x5b, 0x39, 0xff, 0x00, - 0xd4, 0xcb, 0xff, 0x00, 0x2d, 0x2b, 0xcf, 0xbe, - 0xdf, 0xe5, 0x6a, 0xdf, 0x6c, 0x83, 0xfe, 0x59, - 0x54, 0xda, 0xb6, 0xb3, 0x2e, 0xb3, 0x7f, 0xe7, - 0x7f, 0xaa, 0xff, 0xff, 0xd9, - }, - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpmjpeg/encoder_test.go b/pkg/formatdecenc/rtpmjpeg/encoder_test.go index 678c7fc5..143f8785 100644 --- a/pkg/formatdecenc/rtpmjpeg/encoder_test.go +++ b/pkg/formatdecenc/rtpmjpeg/encoder_test.go @@ -2,10 +2,512 @@ package rtpmjpeg import ( "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +var cases = []struct { + name string + image []byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "base", + []byte{ + 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d, + 0x09, 0x0a, 0x0b, 0x0a, 0x08, 0x0d, 0x0b, 0x0a, + 0x0b, 0x0e, 0x0e, 0x0d, 0x0f, 0x13, 0x20, 0x15, + 0x13, 0x12, 0x12, 0x13, 0x27, 0x1c, 0x1e, 0x17, + 0x20, 0x2e, 0x29, 0x31, 0x30, 0x2e, 0x29, 0x2d, + 0x2c, 0x33, 0x3a, 0x4a, 0x3e, 0x33, 0x36, 0x46, + 0x37, 0x2c, 0x2d, 0x40, 0x57, 0x41, 0x46, 0x4c, + 0x4e, 0x52, 0x53, 0x52, 0x32, 0x3e, 0x5a, 0x61, + 0x5a, 0x50, 0x60, 0x4a, 0x51, 0x52, 0x4f, 0x01, + 0x0e, 0x0e, 0x0e, 0x13, 0x11, 0x13, 0x26, 0x15, + 0x15, 0x26, 0x4f, 0x35, 0x2d, 0x35, 0x4f, 0x4f, + 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, + 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, + 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, + 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, + 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, + 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, + 0xff, 0xc0, 0x00, 0x11, 0x08, 0x04, 0x38, 0x07, + 0x80, 0x03, 0x00, 0x22, 0x00, 0x01, 0x11, 0x01, + 0x02, 0x11, 0x01, 0xff, 0xc4, 0x00, 0x1f, 0x00, + 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, + 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, + 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, + 0x7d, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, + 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, + 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, + 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, + 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, + 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, + 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, + 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, + 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, + 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, + 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xff, 0xc4, 0x00, 0x1f, 0x01, + 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0xff, 0xc4, 0x00, 0xb5, + 0x11, 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, + 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, + 0x77, 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, + 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, + 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, + 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, + 0xf0, 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, + 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, + 0x26, 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, + 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, + 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, + 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, + 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, + 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, + 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, + 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, + 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, + 0x00, 0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3f, + 0x00, 0x92, 0x8a, 0x28, 0xaf, 0x54, 0xf2, 0x42, + 0x8a, 0x28, 0xa0, 0x02, 0x96, 0x92, 0x96, 0x80, + 0x0a, 0x4a, 0x75, 0x25, 0x02, 0x12, 0x8a, 0x5a, + 0x28, 0x18, 0x94, 0x52, 0xd1, 0x40, 0x09, 0x45, + 0x2d, 0x14, 0x08, 0x29, 0x69, 0x29, 0x68, 0x00, + 0xa5, 0xa4, 0xa5, 0xa0, 0x02, 0x8a, 0x28, 0xa0, + 0x02, 0x8a, 0x28, 0xa0, 0x04, 0xa5, 0xa2, 0x8a, + 0x00, 0x5a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, + 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x12, 0x8a, 0x5a, + 0x28, 0x24, 0x29, 0x69, 0x29, 0x68, 0x00, 0xa2, + 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, + 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, + 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, + 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, + 0x8a, 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, + 0x8a, 0x28, 0x00, 0xa4, 0xa5, 0xa4, 0xa0, 0x02, + 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, + 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, + 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, + 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, + 0x96, 0x92, 0x96, 0x80, 0x0a, 0x28, 0xa2, 0x80, + 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, + 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, + 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, + 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x81, + 0x85, 0x14, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, + 0x05, 0x14, 0x51, 0x40, 0x05, 0x14, 0x52, 0xd0, + 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, + 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x2d, 0x14, + 0x00, 0x94, 0xb4, 0x51, 0x40, 0x05, 0x14, 0x52, + 0xd0, 0x02, 0x51, 0x4b, 0x45, 0x00, 0x25, 0x2d, + 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, + 0x14, 0x50, 0x20, 0xa5, 0xa4, 0xa5, 0xa0, 0x02, + 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, + 0x8a, 0x5a, 0x28, 0x18, 0x94, 0xb4, 0x51, 0x40, + 0xc2, 0x8a, 0x28, 0xa0, 0x05, 0xa2, 0x92, 0x9d, + 0x40, 0x05, 0x14, 0x51, 0x48, 0x02, 0x8a, 0x28, + 0xa4, 0x01, 0x4b, 0x49, 0x4b, 0x40, 0x05, 0x14, + 0x51, 0x40, 0x05, 0x14, 0xb4, 0x50, 0x02, 0x51, + 0x4b, 0x45, 0x00, 0x25, 0x2d, 0x14, 0x50, 0x03, + 0xa8, 0xa2, 0x8a, 0x00, 0x28, 0xa2, 0x8a, 0x00, + 0x5a, 0x29, 0x29, 0x68, 0x00, 0xa2, 0x8a, 0x28, + 0x00, 0xa2, 0x96, 0x8a, 0x06, 0x25, 0x14, 0xb4, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x02, 0xd2, 0xd2, + 0x52, 0xd0, 0x20, 0xa2, 0x8a, 0x28, 0x01, 0x68, + 0xa2, 0x8a, 0x40, 0x14, 0x51, 0x45, 0x30, 0x0a, + 0x5a, 0x4a, 0x5a, 0x06, 0x14, 0x51, 0x45, 0x02, + 0x0a, 0x28, 0xa5, 0xa0, 0x62, 0x51, 0x4b, 0x45, + 0x00, 0x2d, 0x14, 0x51, 0x48, 0x02, 0x8a, 0x28, + 0xa0, 0x61, 0x45, 0x14, 0x50, 0x03, 0xa8, 0xa2, + 0x8a, 0x06, 0x2d, 0x14, 0x51, 0x48, 0x02, 0x8a, + 0x28, 0xa4, 0x30, 0xa2, 0x8a, 0x2a, 0x80, 0x28, + 0xa2, 0x8a, 0x00, 0x28, 0xa2, 0x8a, 0x92, 0x45, + 0xa5, 0xa2, 0x96, 0x82, 0x82, 0x8a, 0x28, 0xa0, + 0x02, 0x8a, 0x28, 0xa0, 0x05, 0xa2, 0x8a, 0x29, + 0x80, 0x52, 0xd2, 0x52, 0xd0, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x4e, 0xa2, 0x8a, 0x43, 0x0a, 0x28, + 0xa2, 0x80, 0x0a, 0x28, 0xa4, 0xa4, 0x31, 0x68, + 0xa4, 0xf3, 0x62, 0xff, 0x00, 0x9e, 0xd1, 0x7e, + 0xea, 0x9f, 0xfe, 0xb6, 0xa4, 0x62, 0x52, 0x53, + 0xa9, 0x28, 0x01, 0x28, 0xa2, 0x6f, 0xdd, 0x7f, + 0xaf, 0xa5, 0xa0, 0x62, 0x51, 0x4b, 0x45, 0x00, + 0x25, 0x14, 0xbf, 0xba, 0xff, 0x00, 0xae, 0xb4, + 0xea, 0x60, 0x36, 0x9d, 0x49, 0x49, 0x34, 0xb1, + 0x45, 0xfe, 0xbe, 0x6f, 0x2a, 0x98, 0x0f, 0xa2, + 0xb9, 0xbd, 0x0f, 0x59, 0x97, 0x54, 0xf1, 0x2d, + 0xd7, 0xfc, 0xf9, 0xd7, 0x49, 0x52, 0x30, 0xac, + 0x7d, 0x5b, 0x54, 0xd5, 0x74, 0xbf, 0xdf, 0x41, + 0x67, 0x15, 0xd4, 0x35, 0x63, 0x56, 0xd5, 0x22, + 0xd2, 0xe0, 0xf3, 0xbc, 0x99, 0x65, 0xae, 0x4b, + 0x51, 0xf1, 0x44, 0x52, 0xff, 0x00, 0xc7, 0x97, + 0x9b, 0xe4, 0xd0, 0x69, 0x4c, 0x76, 0xa3, 0xe2, + 0xd9, 0xa5, 0x82, 0x29, 0xb4, 0xbf, 0xdd, 0x79, + 0xbf, 0xeb, 0x22, 0xaa, 0x7e, 0x1e, 0xd5, 0x3e, + 0xc1, 0x3f, 0xfa, 0x9f, 0xfa, 0xe9, 0x25, 0x61, + 0xd6, 0x9e, 0x87, 0xf6, 0xbf, 0xed, 0x68, 0xbc, + 0x8a, 0x82, 0xcf, 0x4e, 0x86, 0x5f, 0x36, 0x0a, + 0x92, 0x9b, 0xff, 0x00, 0x5d, 0xeb, 0x3a, 0x6d, + 0x53, 0xfd, 0x3f, 0xec, 0x76, 0x3f, 0xbd, 0xff, + 0x00, 0xa6, 0xbf, 0xc1, 0x54, 0x66, 0x69, 0x51, + 0x50, 0x4b, 0x2c, 0x51, 0x7e, 0xe7, 0xce, 0xf3, + 0x66, 0xff, 0x00, 0xa6, 0x75, 0x35, 0x00, 0x2d, + 0x65, 0x6a, 0xde, 0x23, 0xd3, 0xec, 0x3f, 0xe5, + 0xb7, 0x9b, 0x34, 0x5f, 0xf2, 0xce, 0xb4, 0x7e, + 0xd5, 0x69, 0x2f, 0xfc, 0xbe, 0x45, 0x5e, 0x7b, + 0xe2, 0x7d, 0x07, 0xec, 0x1e, 0x6e, 0xa5, 0xf6, + 0xc8, 0xa5, 0xf3, 0x6a, 0xc0, 0xdf, 0xa2, 0x9d, + 0x45, 0x6c, 0x72, 0x0d, 0xa5, 0xa5, 0xa2, 0x80, + 0x12, 0x96, 0x8a, 0x28, 0x10, 0x51, 0x4b, 0x45, + 0x00, 0x25, 0x14, 0xb4, 0x50, 0x02, 0x51, 0x4b, + 0x45, 0x03, 0x12, 0x8a, 0x5a, 0x28, 0x10, 0x94, + 0xb4, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, 0x05, + 0x14, 0xb4, 0x50, 0x02, 0x51, 0x4b, 0x45, 0x00, + 0x14, 0x51, 0x4b, 0x40, 0x84, 0xa2, 0x8a, 0x28, + 0x00, 0xa2, 0x96, 0x8a, 0x00, 0x4a, 0x29, 0x68, + 0xa0, 0x04, 0xa2, 0x96, 0x8a, 0x00, 0x4a, 0x29, + 0x68, 0xa0, 0x41, 0x45, 0x14, 0x50, 0x01, 0x45, + 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, + 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, + 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, + 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, + 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x49, + 0x4b, 0x45, 0x00, 0x25, 0x14, 0xb4, 0x50, 0x01, + 0x45, 0x14, 0x50, 0x30, 0xa4, 0xa5, 0xa2, 0x81, + 0x09, 0x45, 0x2d, 0x14, 0x00, 0x94, 0x52, 0xd1, + 0x40, 0x09, 0x45, 0x2d, 0x14, 0x00, 0x94, 0x52, + 0xd1, 0x40, 0x05, 0x14, 0xb4, 0x94, 0x0c, 0x28, + 0xa2, 0x8a, 0x04, 0x14, 0x51, 0x45, 0x00, 0x14, + 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, + 0x51, 0x45, 0x00, 0x14, 0x52, 0xd1, 0x40, 0xc4, + 0xa2, 0x96, 0x8a, 0x04, 0x25, 0x14, 0xb4, 0x50, + 0x31, 0x28, 0xa5, 0xa2, 0x80, 0x12, 0x8a, 0x5a, + 0x4a, 0x00, 0x5a, 0x28, 0xa2, 0x80, 0x0a, 0x29, + 0x68, 0xa0, 0x04, 0xa2, 0x96, 0x8a, 0x00, 0x4a, + 0x29, 0x68, 0xa0, 0x04, 0xa2, 0x9d, 0x45, 0x03, + 0x1b, 0x45, 0x3a, 0x8a, 0x00, 0x6d, 0x14, 0xea, + 0x28, 0x10, 0x94, 0x52, 0xd1, 0x40, 0x09, 0x4b, + 0x45, 0x14, 0x08, 0x28, 0xa2, 0x8a, 0x06, 0x14, + 0x52, 0xd1, 0x40, 0x09, 0x45, 0x2d, 0x2d, 0x00, + 0x25, 0x14, 0xb4, 0x50, 0x21, 0x28, 0xa5, 0xa2, + 0x81, 0x89, 0x4b, 0x45, 0x14, 0x00, 0x51, 0x45, + 0x14, 0x00, 0x51, 0x4b, 0x45, 0x00, 0x25, 0x14, + 0xb4, 0x50, 0x01, 0x45, 0x2d, 0x14, 0x0c, 0x28, + 0xa2, 0x8a, 0x00, 0x4a, 0x5a, 0x5a, 0x28, 0x01, + 0x28, 0xa5, 0xa2, 0x90, 0x05, 0x14, 0x51, 0x40, + 0x05, 0x14, 0xb4, 0x52, 0x01, 0x28, 0xa5, 0xa2, + 0x80, 0x0a, 0x28, 0xa7, 0x50, 0x03, 0x68, 0xa7, + 0x51, 0x40, 0x0d, 0xa7, 0x51, 0x45, 0x00, 0x14, + 0x51, 0x4b, 0x40, 0x09, 0x45, 0x2d, 0x2d, 0x00, + 0x25, 0x14, 0xb4, 0x50, 0x02, 0x51, 0x4b, 0x45, + 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, 0x45, + 0x00, 0x14, 0xb4, 0x53, 0xa8, 0x18, 0xda, 0x5a, + 0x5a, 0x28, 0x10, 0x94, 0xb4, 0x51, 0x40, 0xc2, + 0x8a, 0x5a, 0x29, 0x00, 0x94, 0x52, 0xd1, 0x40, + 0x05, 0x14, 0x51, 0x4c, 0x02, 0x96, 0x8a, 0x29, + 0x00, 0x52, 0xd2, 0x52, 0xd0, 0x01, 0x45, 0x14, + 0x50, 0x02, 0xd1, 0x45, 0x14, 0x0c, 0x28, 0xa2, + 0x96, 0x80, 0x0a, 0x28, 0xa2, 0x81, 0x85, 0x2d, + 0x14, 0x50, 0x01, 0x45, 0x14, 0xb4, 0x80, 0x4a, + 0x29, 0x68, 0xa0, 0x62, 0xd1, 0x45, 0x14, 0xc0, + 0x28, 0xa5, 0xa2, 0x90, 0x0d, 0xa5, 0xa5, 0xa2, + 0x80, 0x0a, 0x5a, 0x28, 0xa4, 0x01, 0x45, 0x14, + 0xb4, 0x00, 0x94, 0x52, 0xd1, 0x40, 0x05, 0x14, + 0x51, 0x4c, 0x02, 0x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e6, 0xcd, + 0xff, 0x00, 0x2c, 0xe2, 0xae, 0xa7, 0x49, 0xd5, + 0x3f, 0xe2, 0x9a, 0xf3, 0xa7, 0xff, 0x00, 0x5d, + 0x15, 0x70, 0xb4, 0x43, 0xfb, 0xdf, 0xf5, 0xf3, + 0x4b, 0xff, 0x00, 0x5c, 0xe8, 0xf6, 0x83, 0xf6, + 0x67, 0xa1, 0x68, 0x7a, 0xcc, 0x5a, 0xcf, 0xfd, + 0x32, 0x9b, 0xfe, 0x79, 0xd5, 0xeb, 0xbb, 0xab, + 0x4b, 0x08, 0x3f, 0xd3, 0xab, 0xcd, 0x66, 0xba, + 0xfb, 0x57, 0xfd, 0x32, 0x9a, 0x2a, 0x96, 0xd2, + 0xff, 0x00, 0xcd, 0xbf, 0xf3, 0xb5, 0x49, 0xbc, + 0xdf, 0x2b, 0xfe, 0x59, 0xd3, 0x27, 0xd9, 0x9a, + 0x30, 0xdd, 0x7d, 0xab, 0x5e, 0xfb, 0x1d, 0x8c, + 0xde, 0x55, 0x9c, 0xb2, 0x79, 0x95, 0xd3, 0x6a, + 0x3a, 0xa7, 0xd9, 0x75, 0xdb, 0x5b, 0x39, 0xff, + 0x00, 0xd4, 0xcb, 0xff, 0x00, 0x2d, 0x2b, 0xcf, + 0xbe, 0xdf, 0xe5, 0x6a, 0xdf, 0x6c, 0x83, 0xfe, + 0x59, 0x54, 0xda, 0xb6, 0xb3, 0x2e, 0xb3, 0x7f, + 0xe7, 0x7f, 0xaa, 0xff, 0xff, 0xd9, + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 26, + SequenceNumber: 17645, + Timestamp: 2289528607, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xf0, 0x87, + 0x00, 0x00, 0x00, 0x80, 0x0d, 0x09, 0x0a, 0x0b, + 0x0a, 0x08, 0x0d, 0x0b, 0x0a, 0x0b, 0x0e, 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 0x80, 0x0a, 0x28, 0xa2, 0x80, + 0x12, 0x8a, 0x5a, 0x28, 0x24, 0x29, 0x69, 0x29, + 0x68, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, + 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, + 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, + 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, + 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x8a, + 0x28, 0x00, 0xa2, 0x8a, 0x28, 0x00, 0xa4, 0xa5, + 0xa4, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, + 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, + 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, + 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, + 0x28, 0xa0, 0x02, 0x96, 0x92, 0x96, 0x80, 0x0a, + 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, + 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, + 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, + 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, + 0x28, 0xa2, 0x81, 0x85, 0x14, 0x51, 0x40, 0x05, + 0x14, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, 0x05, + 0x14, 0x52, 0xd0, 0x01, 0x45, 0x14, 0x50, 0x01, + 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, + 0x45, 0x2d, 0x14, 0x00, 0x94, 0xb4, 0x51, 0x40, + 0x05, 0x14, 0x52, 0xd0, 0x02, 0x51, 0x4b, 0x45, + 0x00, 0x25, 0x2d, 0x14, 0x50, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x20, 0xa5, 0xa4, + 0xa5, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x02, 0x8a, + 0x28, 0xa0, 0x02, 0x8a, 0x5a, 0x28, 0x18, 0x94, + 0xb4, 0x51, 0x40, 0xc2, 0x8a, 0x28, 0xa0, 0x05, + 0xa2, 0x92, 0x9d, 0x40, 0x05, 0x14, 0x51, 0x48, + 0x02, 0x8a, 0x28, 0xa4, 0x01, 0x4b, 0x49, 0x4b, + 0x40, 0x05, 0x14, 0x51, 0x40, 0x05, 0x14, 0xb4, + 0x50, 0x02, 0x51, 0x4b, 0x45, 0x00, 0x25, 0x2d, + 0x14, 0x50, 0x03, 0xa8, 0xa2, 0x8a, 0x00, 0x28, + 0xa2, 0x8a, 0x00, 0x5a, 0x29, 0x29, 0x68, 0x00, + 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x96, 0x8a, 0x06, + 0x25, 0x14, 0xb4, 0x50, 0x01, 0x45, 0x14, 0x50, + 0x02, 0xd2, 0xd2, 0x52, 0xd0, 0x20, 0xa2, 0x8a, + 0x28, 0x01, 0x68, 0xa2, 0x8a, 0x40, 0x14, 0x51, + 0x45, 0x30, 0x0a, 0x5a, 0x4a, 0x5a, 0x06, 0x14, + 0x51, 0x45, 0x02, 0x0a, 0x28, 0xa5, 0xa0, 0x62, + 0x51, 0x4b, 0x45, 0x00, 0x2d, 0x14, 0x51, 0x48, + 0x02, 0x8a, 0x28, 0xa0, 0x61, 0x45, 0x14, 0x50, + 0x03, 0xa8, 0xa2, 0x8a, 0x06, 0x2d, 0x14, 0x51, + 0x48, 0x02, 0x8a, 0x28, 0xa4, 0x30, 0xa2, 0x8a, + 0x2a, 0x80, 0x28, 0xa2, 0x8a, 0x00, 0x28, 0xa2, + 0x8a, 0x92, 0x45, 0xa5, 0xa2, 0x96, 0x82, 0x82, + 0x8a, 0x28, 0xa0, 0x02, 0x8a, 0x28, 0xa0, 0x05, + 0xa2, 0x8a, 0x29, 0x80, 0x52, 0xd2, 0x52, 0xd0, + 0x01, 0x45, 0x14, 0x50, 0x01, 0x4e, 0xa2, 0x8a, + 0x43, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa4, + 0xa4, 0x31, 0x68, 0xa4, 0xf3, 0x62, 0xff, 0x00, + 0x9e, 0xd1, 0x7e, 0xea, 0x9f, 0xfe, 0xb6, 0xa4, + 0x62, 0x52, 0x53, 0xa9, 0x28, 0x01, 0x28, 0xa2, + 0x6f, 0xdd, 0x7f, 0xaf, 0xa5, 0xa0, 0x62, 0x51, + 0x4b, 0x45, 0x00, 0x25, 0x14, 0xbf, 0xba, 0xff, + 0x00, 0xae, 0xb4, 0xea, 0x60, 0x36, 0x9d, 0x49, + 0x49, 0x34, 0xb1, 0x45, 0xfe, 0xbe, 0x6f, 0x2a, + 0x98, 0x0f, 0xa2, 0xb9, 0xbd, 0x0f, 0x59, 0x97, + 0x54, 0xf1, 0x2d, 0xd7, 0xfc, 0xf9, 0xd7, 0x49, + 0x52, 0x30, 0xac, 0x7d, 0x5b, 0x54, 0xd5, 0x74, + 0xbf, 0xdf, 0x41, 0x67, 0x15, 0xd4, 0x35, 0x63, + 0x56, 0xd5, 0x22, 0xd2, 0xe0, 0xf3, 0xbc, 0x99, + 0x65, 0xae, 0x4b, 0x51, 0xf1, 0x44, 0x52, 0xff, + 0x00, 0xc7, 0x97, 0x9b, 0xe4, 0xd0, 0x69, 0x4c, + 0x76, 0xa3, 0xe2, 0xd9, 0xa5, 0x82, 0x29, 0xb4, + 0xbf, 0xdd, 0x79, 0xbf, 0xeb, 0x22, 0xaa, 0x7e, + 0x1e, 0xd5, 0x3e, 0xc1, 0x3f, 0xfa, 0x9f, 0xfa, + 0xe9, 0x25, 0x61, 0xd6, 0x9e, 0x87, 0xf6, 0xbf, + 0xed, 0x68, 0xbc, 0x8a, 0x82, 0xcf, 0x4e, 0x86, + 0x5f, 0x36, 0x0a, 0x92, 0x9b, 0xff, 0x00, 0x5d, + 0xeb, 0x3a, 0x6d, 0x53, 0xfd, 0x3f, 0xec, 0x76, + 0x3f, 0xbd, 0xff, 0x00, 0xa6, 0xbf, 0xc1, 0x54, + 0x66, 0x69, 0x51, 0x50, 0x4b, 0x2c, 0x51, 0x7e, + 0xe7, 0xce, 0xf3, 0x66, 0xff, 0x00, 0xa6, 0x75, + 0x35, 0x00, 0x2d, 0x65, 0x6a, 0xde, 0x23, 0xd3, + 0xec, 0x3f, 0xe5, 0xb7, 0x9b, 0x34, 0x5f, 0xf2, + 0xce, 0xb4, 0x7e, 0xd5, 0x69, 0x2f, 0xfc, 0xbe, + 0x45, 0x5e, 0x7b, 0xe2, 0x7d, 0x07, 0xec, 0x1e, + 0x6e, 0xa5, 0xf6, 0xc8, 0xa5, 0xf3, 0x6a, 0xc0, + 0xdf, 0xa2, 0x9d, 0x45, 0x6c, 0x72, 0x0d, 0xa5, + 0xa5, 0xa2, 0x80, 0x12, 0x96, 0x8a, 0x28, 0x10, + 0x51, 0x4b, 0x45, 0x00, 0x25, 0x14, 0xb4, 0x50, + 0x02, 0x51, 0x4b, 0x45, 0x03, 0x12, 0x8a, 0x5a, + 0x28, 0x10, 0x94, 0xb4, 0x51, 0x40, 0x05, 0x14, + 0x51, 0x40, 0x05, 0x14, 0xb4, 0x50, 0x02, 0x51, + 0x4b, 0x45, 0x00, 0x14, 0x51, 0x4b, 0x40, 0x84, + 0xa2, 0x8a, 0x28, 0x00, 0xa2, 0x96, 0x8a, 0x00, + 0x4a, 0x29, 0x68, 0xa0, 0x04, 0xa2, 0x96, 0x8a, + 0x00, 0x4a, 0x29, 0x68, 0xa0, 0x41, 0x45, 0x14, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x45, 0x14, 0x50, 0x01, 0x45, 0x14, + 0x50, 0x01, 0x49, 0x4b, 0x45, 0x00, 0x25, 0x14, + 0xb4, 0x50, 0x01, 0x45, 0x14, 0x50, 0x30, 0xa4, + 0xa5, 0xa2, 0x81, 0x09, 0x45, 0x2d, 0x14, 0x00, + 0x94, 0x52, 0xd1, 0x40, 0x09, 0x45, 0x2d, 0x14, + 0x00, 0x94, 0x52, 0xd1, 0x40, 0x05, 0x14, 0xb4, + 0x94, 0x0c, 0x28, 0xa2, 0x8a, 0x04, 0x14, 0x51, + 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x51, + 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, 0x14, 0x52, + 0xd1, 0x40, 0xc4, 0xa2, 0x96, 0x8a, 0x04, 0x25, + 0x14, 0xb4, 0x50, 0x31, 0x28, 0xa5, 0xa2, 0x80, + 0x12, 0x8a, 0x5a, 0x4a, 0x00, 0x5a, 0x28, 0xa2, + 0x80, 0x0a, 0x29, 0x68, 0xa0, 0x04, 0xa2, 0x96, + 0x8a, 0x00, 0x4a, 0x29, 0x68, 0xa0, 0x04, 0xa2, + 0x9d, 0x45, 0x03, 0x1b, 0x45, 0x3a, 0x8a, 0x00, + 0x6d, 0x14, 0xea, 0x28, 0x10, 0x94, 0x52, 0xd1, + 0x40, 0x09, 0x4b, 0x45, 0x14, 0x08, 0x28, 0xa2, + 0x8a, 0x06, 0x14, 0x52, 0xd1, 0x40, 0x09, 0x45, + 0x2d, 0x2d, 0x00, 0x25, 0x14, 0xb4, 0x50, 0x21, + 0x28, 0xa5, 0xa2, 0x81, 0x89, 0x4b, 0x45, 0x14, + 0x00, 0x51, 0x45, 0x14, 0x00, 0x51, 0x4b, 0x45, + 0x00, 0x25, 0x14, 0xb4, 0x50, 0x01, 0x45, 0x2d, + 0x14, 0x0c, 0x28, 0xa2, 0x8a, 0x00, 0x4a, 0x5a, + 0x5a, 0x28, 0x01, 0x28, 0xa5, 0xa2, 0x90, 0x05, + 0x14, 0x51, 0x40, 0x05, 0x14, 0xb4, 0x52, 0x01, + 0x28, 0xa5, 0xa2, 0x80, 0x0a, 0x28, 0xa7, 0x50, + 0x03, 0x68, 0xa7, 0x51, 0x40, 0x0d, 0xa7, 0x51, + 0x45, 0x00, 0x14, 0x51, 0x4b, 0x40, 0x09, 0x45, + 0x2d, 0x2d, 0x00, 0x25, 0x14, 0xb4, 0x50, 0x02, + 0x51, 0x4b, 0x45, 0x00, 0x14, 0x51, 0x45, 0x00, + 0x14, 0x51, 0x45, 0x00, 0x14, 0xb4, 0x53, 0xa8, + 0x18, 0xda, 0x5a, 0x5a, 0x28, 0x10, 0x94, 0xb4, + 0x51, 0x40, 0xc2, 0x8a, 0x5a, 0x29, 0x00, 0x94, + 0x52, 0xd1, 0x40, 0x05, 0x14, 0x51, 0x4c, 0x02, + 0x96, 0x8a, 0x29, 0x00, 0x52, 0xd2, 0x52, 0xd0, + 0x01, 0x45, 0x14, 0x50, 0x02, 0xd1, 0x45, 0x14, + 0x0c, 0x28, 0xa2, 0x96, 0x80, 0x0a, 0x28, 0xa2, + 0x81, 0x85, 0x2d, 0x14, 0x50, 0x01, 0x45, 0x14, + 0xb4, 0x80, 0x4a, 0x29, 0x68, 0xa0, 0x62, 0xd1, + 0x45, 0x14, 0xc0, 0x28, 0xa5, 0xa2, 0x90, 0x0d, + 0xa5, 0xa5, 0xa2, 0x80, 0x0a, 0x5a, 0x28, 0xa4, + 0x01, 0x45, 0x14, 0xb4, 0x00, 0x94, 0x52, 0xd1, + 0x40, 0x05, 0x14, 0x51, 0x4c, 0x02, 0x8a, 0x29, + 0x68, 0x01, 0x28, 0xa5, 0xa2, 0x80, 0x16, 0x8a, + 0x28, 0xa4, 0x30, 0xa7, 0x55, 0x7b, 0xbb, 0x5f, + 0xb7, 0xc1, 0xe4, 0xff, 0x00, 0xaa, 0xac, 0x49, + 0xb4, 0x6d, 0x57, 0x4b, 0xf3, 0x66, 0xd2, 0xef, + 0x3c, 0xd8, 0x69, 0x17, 0x4c, 0xe9, 0x2b, 0x07, + 0xc4, 0x32, 0xcb, 0x75, 0xa4, 0xff, 0x00, 0xc4, + 0xae, 0x68, 0xbf, 0x75, 0xfe, 0xb2, 0xb9, 0x09, + 0xb5, 0x9d, 0x42, 0x5f, 0x36, 0xcf, 0xce, 0xff, + 0x00, 0x5b, 0x56, 0x3c, 0x3d, 0x6b, 0xfd, 0xa9, + 0xab, 0x4b, 0x67, 0x3f, 0xfc, 0xf3, 0xff, 0x00, + 0x96, 0x74, 0x8d, 0xbd, 0x99, 0x9b, 0x0d, 0xfc, + 0xb2, 0xf9, 0xbf, 0xeb, 0x7f, 0x7b, 0x5a, 0xf0, + 0xf8, 0x8e, 0xee, 0x2d, 0x27, 0xec, 0x70, 0x7f, + 0xdf, 0xca, 0x66, 0xa3, 0xe1, 0x7f, 0xb0, 0x79, + 0xbe, 0x46, 0xa5, 0x17, 0xfd, 0x73, 0x92, 0xb0, + 0xe1, 0xa8, 0x0f, 0x66, 0x76, 0x90, 0xf8, 0xa2, + 0x29, 0x6c, 0x3c, 0x9f, 0xde, 0xf9, 0xde, 0x5f, + 0xef, 0x24, 0xaa, 0x76, 0x9e, 0x2d, 0xbb, 0x8b, + 0x49, 0xf2, 0x7f, 0xe5, 0xb5, 0x62, 0x5a, 0x5f, + 0xcb, 0x6b, 0xfe, 0xa3, 0xfe, 0x5a, 0xd1, 0xe5, + 0x45, 0xff, 0x00, 0x2c, 0x29, 0x0f, 0xd9, 0x97, + 0xff, 0x00, 0xb6, 0x65, + }, + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 26, + SequenceNumber: 17646, + Timestamp: 2289528607, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x00, 0x00, 0x05, 0x28, 0x01, 0xff, 0xf0, 0x87, + 0xba, 0x82, 0x5f, 0xb7, 0x4d, 0xe6, 0xcd, 0xff, + 0x00, 0x2c, 0xe2, 0xae, 0xa7, 0x49, 0xd5, 0x3f, + 0xe2, 0x9a, 0xf3, 0xa7, 0xff, 0x00, 0x5d, 0x15, + 0x70, 0xb4, 0x43, 0xfb, 0xdf, 0xf5, 0xf3, 0x4b, + 0xff, 0x00, 0x5c, 0xe8, 0xf6, 0x83, 0xf6, 0x67, + 0xa1, 0x68, 0x7a, 0xcc, 0x5a, 0xcf, 0xfd, 0x32, + 0x9b, 0xfe, 0x79, 0xd5, 0xeb, 0xbb, 0xab, 0x4b, + 0x08, 0x3f, 0xd3, 0xab, 0xcd, 0x66, 0xba, 0xfb, + 0x57, 0xfd, 0x32, 0x9a, 0x2a, 0x96, 0xd2, 0xff, + 0x00, 0xcd, 0xbf, 0xf3, 0xb5, 0x49, 0xbc, 0xdf, + 0x2b, 0xfe, 0x59, 0xd3, 0x27, 0xd9, 0x9a, 0x30, + 0xdd, 0x7d, 0xab, 0x5e, 0xfb, 0x1d, 0x8c, 0xde, + 0x55, 0x9c, 0xb2, 0x79, 0x95, 0xd3, 0x6a, 0x3a, + 0xa7, 0xd9, 0x75, 0xdb, 0x5b, 0x39, 0xff, 0x00, + 0xd4, 0xcb, 0xff, 0x00, 0x2d, 0x2b, 0xcf, 0xbe, + 0xdf, 0xe5, 0x6a, 0xdf, 0x6c, 0x83, 0xfe, 0x59, + 0x54, 0xda, 0xb6, 0xb3, 0x2e, 0xb3, 0x7f, 0xe7, + 0x7f, 0xaa, 0xff, 0xff, 0xd9, + }, + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go b/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go index e414b107..3552df58 100644 --- a/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go +++ b/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go @@ -1,7 +1,9 @@ +//go:build go1.18 +// +build go1.18 + package rtpmpeg4audio import ( - "bytes" "testing" "time" @@ -11,478 +13,6 @@ import ( "github.com/aler9/gortsplib/v2/pkg/codecs/mpeg4audio" ) -func mergeBytes(vals ...[]byte) []byte { - size := 0 - for _, v := range vals { - size += len(v) - } - res := make([]byte, size) - - pos := 0 - for _, v := range vals { - n := copy(res[pos:], v) - pos += n - } - - return res -} - -var cases = []struct { - name string - sizeLength int - indexLength int - indexDeltaLength int - aus [][]byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "single", - 13, - 3, - 3, - [][]byte{ - { - 0x21, 0x1a, 0xd4, 0xf5, 0x9e, 0x20, 0xc5, 0x42, - 0x89, 0x40, 0xa2, 0x9b, 0x3c, 0x94, 0xdd, 0x28, - 0x94, 0x48, 0xd5, 0x8b, 0xb0, 0x2, 0xdb, 0x1b, - 0xeb, 0xe0, 0xfa, 0x9f, 0xea, 0x91, 0xa7, 0x3, - 0xe8, 0x6b, 0xe5, 0x5, 0x95, 0x6, 0x62, 0x88, - 0x13, 0xa, 0x15, 0xa0, 0xeb, 0xef, 0x40, 0x82, - 0xdf, 0x49, 0xf2, 0xe0, 0x26, 0xfc, 0x52, 0x5b, - 0x6c, 0x2a, 0x2d, 0xe8, 0xa5, 0x70, 0xc5, 0xaf, - 0xfc, 0x98, 0x9a, 0x2f, 0x1f, 0xbb, 0xa2, 0xcb, - 0xb8, 0x26, 0xb6, 0x6e, 0x4c, 0x15, 0x6c, 0x21, - 0x3d, 0x35, 0xf6, 0xcf, 0xa4, 0x3b, 0x72, 0x26, - 0xe1, 0x3a, 0x3a, 0x99, 0xd8, 0x2d, 0x6a, 0x22, - 0xcd, 0x97, 0xa, 0xef, 0x52, 0x9c, 0x5f, 0xcd, - 0x5c, 0xd9, 0xd3, 0x12, 0x7e, 0x45, 0x45, 0xb3, - 0x24, 0xef, 0xd3, 0x4f, 0x2f, 0x96, 0xd9, 0x8b, - 0x9c, 0xc2, 0xcd, 0x54, 0xb, 0x6e, 0x19, 0x84, - 0x56, 0xeb, 0x85, 0x52, 0x63, 0x64, 0x28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x8e, 0x6d, 0x64, 0xdc, 0x64, 0x1f, - 0x33, 0x53, 0x4e, 0xd8, 0xa4, 0x74, 0xf3, 0x33, - 0x4, 0x68, 0xd9, 0x92, 0xf3, 0x6e, 0xb7, 0x5b, - 0xe6, 0xf6, 0xc3, 0x55, 0x14, 0x54, 0x87, 0x0, - 0xaf, 0x7, - }, - }, - 20 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x00, 0x10, 0x0a, 0xd8, - 0x21, 0x1a, 0xd4, 0xf5, 0x9e, 0x20, 0xc5, 0x42, - 0x89, 0x40, 0xa2, 0x9b, 0x3c, 0x94, 0xdd, 0x28, - 0x94, 0x48, 0xd5, 0x8b, 0xb0, 0x02, 0xdb, 0x1b, - 0xeb, 0xe0, 0xfa, 0x9f, 0xea, 0x91, 0xa7, 0x03, - 0xe8, 0x6b, 0xe5, 0x05, 0x95, 0x06, 0x62, 0x88, - 0x13, 0x0a, 0x15, 0xa0, 0xeb, 0xef, 0x40, 0x82, - 0xdf, 0x49, 0xf2, 0xe0, 0x26, 0xfc, 0x52, 0x5b, - 0x6c, 0x2a, 0x2d, 0xe8, 0xa5, 0x70, 0xc5, 0xaf, - 0xfc, 0x98, 0x9a, 0x2f, 0x1f, 0xbb, 0xa2, 0xcb, - 0xb8, 0x26, 0xb6, 0x6e, 0x4c, 0x15, 0x6c, 0x21, - 0x3d, 0x35, 0xf6, 0xcf, 0xa4, 0x3b, 0x72, 0x26, - 0xe1, 0x3a, 0x3a, 0x99, 0xd8, 0x2d, 0x6a, 0x22, - 0xcd, 0x97, 0x0a, 0xef, 0x52, 0x9c, 0x5f, 0xcd, - 0x5c, 0xd9, 0xd3, 0x12, 0x7e, 0x45, 0x45, 0xb3, - 0x24, 0xef, 0xd3, 0x4f, 0x2f, 0x96, 0xd9, 0x8b, - 0x9c, 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xb6, 0x95, 0x44, - 0x1a, 0x0d, 0xc0, 0x15, 0x0f, 0xd2, 0xc3, 0x72, - 0x4d, 0x6e, 0x4f, 0x8e, 0x6d, 0x64, 0xdc, 0x64, - 0x1f, 0x33, 0x53, 0x4e, 0xd8, 0xa4, 0x74, 0xf3, - 0x33, 0x04, 0x68, 0xd9, 0x92, 0xf3, 0x6e, 0xb7, - 0x5b, 0xe6, 0xf6, 0xc3, 0x55, 0x14, 0x54, 0x87, - 0x00, 0xaf, 0x07, - }, - }, - }, - }, - { - "aggregated", - 13, - 3, - 3, - [][]byte{ - {0x00, 0x01, 0x02, 0x03}, - {0x04, 0x05, 0x06, 0x07}, - {0x08, 0x09, 0x0A, 0x0B}, - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x0, 0x30, 0x0, 0x20, - 0x0, 0x20, 0x0, 0x20, 0x0, 0x1, 0x2, 0x3, - 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, - }, - }, - }, - }, - { - "fragmented", - 13, - 3, - 3, - [][]byte{ - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 512), - }, - 0, - []*rtp.Packet{ //nolint:dupl - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x10, 0x2d, 0x80}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x00, 0x10, 0x2d, 0x80}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x00, 0x10, 0x25, 0x00}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 148), - ), - }, - }, - }, - { - "aggregated followed by fragmented", - 13, - 3, - 3, - [][]byte{ - {0x00, 0x01, 0x02, 0x03}, - {0x04, 0x05, 0x06, 0x07}, - {0x08, 0x09, 0x0A, 0x0B}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 256), - }, - 0, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289526357, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x0, 0x30, 0x0, 0x20, - 0x0, 0x20, 0x0, 0x20, 0x0, 0x1, 0x2, 0x3, - 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, - }, - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289529429, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x10, 0x2d, 0x80}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289529429, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x00, 0x10, 0x12, 0x80}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 74), - ), - }, - }, - }, - { - "single, custom sized", - 6, - 2, - 2, - [][]byte{ - {0x01, 0x02, 0x03, 0x04}, - }, - 20 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x00, 0x08, 0x10, - 0x01, 0x02, 0x03, 0x04, - }, - }, - }, - }, - { - "single, custom sized, padded", - 13, - 0, - 0, - [][]byte{ - {0x01, 0x02, 0x03, 0x04}, - }, - 20 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x00, 0x0d, 0x00, 0x20, - 0x01, 0x02, 0x03, 0x04, - }, - }, - }, - }, - { - "aggregated, custom sized, padded", - 13, - 0, - 0, - [][]byte{ - {0x01, 0x02, 0x03, 0x04}, - {0x05, 0x06, 0x07, 0x08}, - }, - 20 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{ - 0x00, 0x1a, 0x00, 0x20, 0x01, 0x00, - 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, 0x08, - }, - }, - }, - }, - { - "fragmented, custom sized", - 21, - 3, - 3, - [][]byte{ - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 512), - }, - 20 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x18, 0x00, 0x2d, 0x78}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 181), - []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06}, - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x00, 0x18, 0x00, 0x2d, 0x78, 0x07}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 181), - []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}, - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x00, 0x18, 0x00, 0x25, 0x10, 0x06, 0x07}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 148), - ), - }, - }, - }, - { - "fragmented, custom sized, padded", - 13, - 0, - 0, - [][]byte{ - bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 512), - }, - 20 * time.Millisecond, - []*rtp.Packet{ //nolint:dupl - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x0d, 0x2d, 0x80}, - bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x0d, 0x2d, 0x80}, - bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x00, 0x0d, 0x25, 0x00}, - bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 148), - ), - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpmpeg4audio/encoder_test.go b/pkg/formatdecenc/rtpmpeg4audio/encoder_test.go index e88ca115..dd5afde7 100644 --- a/pkg/formatdecenc/rtpmpeg4audio/encoder_test.go +++ b/pkg/formatdecenc/rtpmpeg4audio/encoder_test.go @@ -1,11 +1,486 @@ package rtpmpeg4audio import ( + "bytes" "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +func mergeBytes(vals ...[]byte) []byte { + size := 0 + for _, v := range vals { + size += len(v) + } + res := make([]byte, size) + + pos := 0 + for _, v := range vals { + n := copy(res[pos:], v) + pos += n + } + + return res +} + +var cases = []struct { + name string + sizeLength int + indexLength int + indexDeltaLength int + aus [][]byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "single", + 13, + 3, + 3, + [][]byte{ + { + 0x21, 0x1a, 0xd4, 0xf5, 0x9e, 0x20, 0xc5, 0x42, + 0x89, 0x40, 0xa2, 0x9b, 0x3c, 0x94, 0xdd, 0x28, + 0x94, 0x48, 0xd5, 0x8b, 0xb0, 0x2, 0xdb, 0x1b, + 0xeb, 0xe0, 0xfa, 0x9f, 0xea, 0x91, 0xa7, 0x3, + 0xe8, 0x6b, 0xe5, 0x5, 0x95, 0x6, 0x62, 0x88, + 0x13, 0xa, 0x15, 0xa0, 0xeb, 0xef, 0x40, 0x82, + 0xdf, 0x49, 0xf2, 0xe0, 0x26, 0xfc, 0x52, 0x5b, + 0x6c, 0x2a, 0x2d, 0xe8, 0xa5, 0x70, 0xc5, 0xaf, + 0xfc, 0x98, 0x9a, 0x2f,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9, 0xab, + 0xfd, 0xcf, 0x8e, 0x78, 0xbd, 0x4d, 0x70, 0x81, + 0x9b, 0x2d, 0x85, 0x94, 0x74, 0x2a, 0x3a, 0xb4, + 0xff, 0x4a, 0x13, 0x70, 0x76, 0x2c, 0x2f, 0x13, + 0x5b, 0x43, 0xf9, 0x17, 0xee, 0x26, 0x37, 0x1, + 0xbc, 0x9f, 0xb, 0xe, 0x68, 0xcb, 0x87, 0x65, + 0x86, 0xcc, 0x4c, 0x2f, 0x7a, 0x14, 0xd, 0xd1, + 0xb9, 0x57, 0xbd, 0x50, 0xb6, 0x95, 0x44, 0x1a, + 0xd, 0xc0, 0x15, 0xf, 0xd2, 0xc3, 0x72, 0x4d, + 0x6e, 0x4f, 0x8e, 0x6d, 0x64, 0xdc, 0x64, 0x1f, + 0x33, 0x53, 0x4e, 0xd8, 0xa4, 0x74, 0xf3, 0x33, + 0x4, 0x68, 0xd9, 0x92, 0xf3, 0x6e, 0xb7, 0x5b, + 0xe6, 0xf6, 0xc3, 0x55, 0x14, 0x54, 0x87, 0x0, + 0xaf, 0x7, + }, + }, + 20 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x00, 0x10, 0x0a, 0xd8, + 0x21, 0x1a, 0xd4, 0xf5, 0x9e, 0x20, 0xc5, 0x42, + 0x89, 0x40, 0xa2, 0x9b, 0x3c, 0x94, 0xdd, 0x28, + 0x94, 0x48, 0xd5, 0x8b, 0xb0, 0x02, 0xdb, 0x1b, + 0xeb, 0xe0, 0xfa, 0x9f, 0xea, 0x91, 0xa7, 0x03, + 0xe8, 0x6b, 0xe5, 0x05, 0x95, 0x06, 0x62, 0x88, + 0x13, 0x0a, 0x15, 0xa0, 0xeb, 0xef, 0x40, 0x82, + 0xdf, 0x49, 0xf2, 0xe0, 0x26, 0xfc, 0x52, 0x5b,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x9b, 0xc9, 0xb7, 0x4e, 0x44, 0x4c, + 0x98, 0x6a, 0x5f, 0x3b, 0x97, 0x81, 0x9b, 0xa9, + 0xab, 0xfd, 0xcf, 0x8e, 0x78, 0xbd, 0x4d, 0x70, + 0x81, 0x9b, 0x2d, 0x85, 0x94, 0x74, 0x2a, 0x3a, + 0xb4, 0xff, 0x4a, 0x13, 0x70, 0x76, 0x2c, 0x2f, + 0x13, 0x5b, 0x43, 0xf9, 0x17, 0xee, 0x26, 0x37, + 0x01, 0xbc, 0x9f, 0x0b, 0x0e, 0x68, 0xcb, 0x87, + 0x65, 0x86, 0xcc, 0x4c, 0x2f, 0x7a, 0x14, 0x0d, + 0xd1, 0xb9, 0x57, 0xbd, 0x50, 0xb6, 0x95, 0x44, + 0x1a, 0x0d, 0xc0, 0x15, 0x0f, 0xd2, 0xc3, 0x72, + 0x4d, 0x6e, 0x4f, 0x8e, 0x6d, 0x64, 0xdc, 0x64, + 0x1f, 0x33, 0x53, 0x4e, 0xd8, 0xa4, 0x74, 0xf3, + 0x33, 0x04, 0x68, 0xd9, 0x92, 0xf3, 0x6e, 0xb7, + 0x5b, 0xe6, 0xf6, 0xc3, 0x55, 0x14, 0x54, 0x87, + 0x00, 0xaf, 0x07, + }, + }, + }, + }, + { + "aggregated", + 13, + 3, + 3, + [][]byte{ + {0x00, 0x01, 0x02, 0x03}, + {0x04, 0x05, 0x06, 0x07}, + {0x08, 0x09, 0x0A, 0x0B}, + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x0, 0x30, 0x0, 0x20, + 0x0, 0x20, 0x0, 0x20, 0x0, 0x1, 0x2, 0x3, + 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, + }, + }, + }, + }, + { + "fragmented", + 13, + 3, + 3, + [][]byte{ + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 512), + }, + 0, + []*rtp.Packet{ //nolint:dupl + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x0, 0x10, 0x2d, 0x80}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x00, 0x10, 0x2d, 0x80}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x00, 0x10, 0x25, 0x00}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 148), + ), + }, + }, + }, + { + "aggregated followed by fragmented", + 13, + 3, + 3, + [][]byte{ + {0x00, 0x01, 0x02, 0x03}, + {0x04, 0x05, 0x06, 0x07}, + {0x08, 0x09, 0x0A, 0x0B}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 256), + }, + 0, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289526357, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x0, 0x30, 0x0, 0x20, + 0x0, 0x20, 0x0, 0x20, 0x0, 0x1, 0x2, 0x3, + 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, + }, + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289529429, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x0, 0x10, 0x2d, 0x80}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289529429, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x00, 0x10, 0x12, 0x80}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 74), + ), + }, + }, + }, + { + "single, custom sized", + 6, + 2, + 2, + [][]byte{ + {0x01, 0x02, 0x03, 0x04}, + }, + 20 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x00, 0x08, 0x10, + 0x01, 0x02, 0x03, 0x04, + }, + }, + }, + }, + { + "single, custom sized, padded", + 13, + 0, + 0, + [][]byte{ + {0x01, 0x02, 0x03, 0x04}, + }, + 20 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x00, 0x0d, 0x00, 0x20, + 0x01, 0x02, 0x03, 0x04, + }, + }, + }, + }, + { + "aggregated, custom sized, padded", + 13, + 0, + 0, + [][]byte{ + {0x01, 0x02, 0x03, 0x04}, + {0x05, 0x06, 0x07, 0x08}, + }, + 20 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: []byte{ + 0x00, 0x1a, 0x00, 0x20, 0x01, 0x00, + 0x01, 0x02, 0x03, 0x04, + 0x05, 0x06, 0x07, 0x08, + }, + }, + }, + }, + { + "fragmented, custom sized", + 21, + 3, + 3, + [][]byte{ + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 512), + }, + 20 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x0, 0x18, 0x00, 0x2d, 0x78}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 181), + []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06}, + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x00, 0x18, 0x00, 0x2d, 0x78, 0x07}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 181), + []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}, + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x00, 0x18, 0x00, 0x25, 0x10, 0x06, 0x07}, + bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 148), + ), + }, + }, + }, + { + "fragmented, custom sized, padded", + 13, + 0, + 0, + [][]byte{ + bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 512), + }, + 20 * time.Millisecond, + []*rtp.Packet{ //nolint:dupl + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x0, 0x0d, 0x2d, 0x80}, + bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 182), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x0, 0x0d, 0x2d, 0x80}, + bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 182), + ), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes( + []byte{0x00, 0x0d, 0x25, 0x00}, + bytes.Repeat([]byte{0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, 148), + ), + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpsimpleaudio/decoder_test.go b/pkg/formatdecenc/rtpsimpleaudio/decoder_test.go index bd86046e..5cc80af1 100644 --- a/pkg/formatdecenc/rtpsimpleaudio/decoder_test.go +++ b/pkg/formatdecenc/rtpsimpleaudio/decoder_test.go @@ -1,37 +1,15 @@ +//go:build go1.18 +// +build go1.18 + package rtpsimpleaudio import ( "testing" - "time" "github.com/pion/rtp" "github.com/stretchr/testify/require" ) -var cases = []struct { - name string - frame []byte - pts time.Duration - pkt *rtp.Packet -}{ - { - "single", - []byte{0x01, 0x02, 0x03, 0x04}, - 25 * time.Millisecond, - &rtp.Packet{ - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 0, - SequenceNumber: 17645, - Timestamp: 2289526557, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x01, 0x02, 0x03, 0x04}, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpsimpleaudio/encoder_test.go b/pkg/formatdecenc/rtpsimpleaudio/encoder_test.go index ac9f0cf2..6243a122 100644 --- a/pkg/formatdecenc/rtpsimpleaudio/encoder_test.go +++ b/pkg/formatdecenc/rtpsimpleaudio/encoder_test.go @@ -2,10 +2,36 @@ package rtpsimpleaudio import ( "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +var cases = []struct { + name string + frame []byte + pts time.Duration + pkt *rtp.Packet +}{ + { + "single", + []byte{0x01, 0x02, 0x03, 0x04}, + 25 * time.Millisecond, + &rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 0, + SequenceNumber: 17645, + Timestamp: 2289526557, + SSRC: 0x9dbb7812, + }, + Payload: []byte{0x01, 0x02, 0x03, 0x04}, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpvp8/decoder_test.go b/pkg/formatdecenc/rtpvp8/decoder_test.go index d70f29cb..0e3d9344 100644 --- a/pkg/formatdecenc/rtpvp8/decoder_test.go +++ b/pkg/formatdecenc/rtpvp8/decoder_test.go @@ -1,7 +1,9 @@ +//go:build go1.18 +// +build go1.18 + package rtpvp8 import ( - "bytes" "testing" "time" @@ -9,88 +11,6 @@ import ( "github.com/stretchr/testify/require" ) -func mergeBytes(vals ...[]byte) []byte { - size := 0 - for _, v := range vals { - size += len(v) - } - res := make([]byte, size) - - pos := 0 - for _, v := range vals { - n := copy(res[pos:], v) - pos += n - } - - return res -} - -var cases = []struct { - name string - frame []byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "single", - []byte{0x01, 0x02, 0x03, 0x04}, - 25 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289528607, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x10, 0x01, 0x02, 0x03, 0x04}, - }, - }, - }, - { - "fragmented", - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 4096/4), - 55 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes([]byte{0x10}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), []byte{0x01, 0x02, 0x03}), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes([]byte{0x00, 0x04}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), []byte{0x01, 0x02}), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes([]byte{0x00, 0x03, 0x04}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 294)), - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpvp8/encoder_test.go b/pkg/formatdecenc/rtpvp8/encoder_test.go index 8bb6857a..72cd9333 100644 --- a/pkg/formatdecenc/rtpvp8/encoder_test.go +++ b/pkg/formatdecenc/rtpvp8/encoder_test.go @@ -1,11 +1,96 @@ package rtpvp8 import ( + "bytes" "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +func mergeBytes(vals ...[]byte) []byte { + size := 0 + for _, v := range vals { + size += len(v) + } + res := make([]byte, size) + + pos := 0 + for _, v := range vals { + n := copy(res[pos:], v) + pos += n + } + + return res +} + +var cases = []struct { + name string + frame []byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "single", + []byte{0x01, 0x02, 0x03, 0x04}, + 25 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289528607, + SSRC: 0x9dbb7812, + }, + Payload: []byte{0x10, 0x01, 0x02, 0x03, 0x04}, + }, + }, + }, + { + "fragmented", + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 4096/4), + 55 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes([]byte{0x10}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), []byte{0x01, 0x02, 0x03}), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes([]byte{0x00, 0x04}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), []byte{0x01, 0x02}), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes([]byte{0x00, 0x03, 0x04}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 294)), + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpvp9/decoder_test.go b/pkg/formatdecenc/rtpvp9/decoder_test.go index 682b6b7e..5df79345 100644 --- a/pkg/formatdecenc/rtpvp9/decoder_test.go +++ b/pkg/formatdecenc/rtpvp9/decoder_test.go @@ -1,7 +1,9 @@ +//go:build go1.18 +// +build go1.18 + package rtpvp9 import ( - "bytes" "testing" "time" @@ -9,89 +11,6 @@ import ( "github.com/stretchr/testify/require" ) -func mergeBytes(vals ...[]byte) []byte { - size := 0 - for _, v := range vals { - size += len(v) - } - res := make([]byte, size) - - pos := 0 - for _, v := range vals { - n := copy(res[pos:], v) - pos += n - } - - return res -} - -var cases = []struct { - name string - frame []byte - pts time.Duration - pkts []*rtp.Packet -}{ - { - "single", - []byte{0x01, 0x02, 0x03, 0x04}, - 25 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289528607, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x9c, 0xb5, 0xaf, 0x01, 0x02, 0x03, 0x04}, - }, - }, - }, - { - "fragmented", - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 4096/4), - 55 * time.Millisecond, - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes([]byte{0x98, 0xb5, 0xaf}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), []byte{0x01}), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes([]byte{0x90, 0xb5, 0xaf, 0x02, 0x03, 0x04}, - bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 363), []byte{0x01, 0x02}), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17647, - Timestamp: 2289531307, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes([]byte{0x94, 0xb5, 0xaf, 0x03, 0x04}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 295)), - }, - }, - }, -} - func TestDecode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) { diff --git a/pkg/formatdecenc/rtpvp9/encoder_test.go b/pkg/formatdecenc/rtpvp9/encoder_test.go index e212c3ba..7a94527a 100644 --- a/pkg/formatdecenc/rtpvp9/encoder_test.go +++ b/pkg/formatdecenc/rtpvp9/encoder_test.go @@ -1,11 +1,97 @@ package rtpvp9 import ( + "bytes" "testing" + "time" + "github.com/pion/rtp" "github.com/stretchr/testify/require" ) +func mergeBytes(vals ...[]byte) []byte { + size := 0 + for _, v := range vals { + size += len(v) + } + res := make([]byte, size) + + pos := 0 + for _, v := range vals { + n := copy(res[pos:], v) + pos += n + } + + return res +} + +var cases = []struct { + name string + frame []byte + pts time.Duration + pkts []*rtp.Packet +}{ + { + "single", + []byte{0x01, 0x02, 0x03, 0x04}, + 25 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289528607, + SSRC: 0x9dbb7812, + }, + Payload: []byte{0x9c, 0xb5, 0xaf, 0x01, 0x02, 0x03, 0x04}, + }, + }, + }, + { + "fragmented", + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 4096/4), + 55 * time.Millisecond, + []*rtp.Packet{ + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes([]byte{0x98, 0xb5, 0xaf}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 364), []byte{0x01}), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17646, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes([]byte{0x90, 0xb5, 0xaf, 0x02, 0x03, 0x04}, + bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 363), []byte{0x01, 0x02}), + }, + { + Header: rtp.Header{ + Version: 2, + Marker: true, + PayloadType: 96, + SequenceNumber: 17647, + Timestamp: 2289531307, + SSRC: 0x9dbb7812, + }, + Payload: mergeBytes([]byte{0x94, 0xb5, 0xaf, 0x03, 0x04}, bytes.Repeat([]byte{0x01, 0x02, 0x03, 0x04}, 295)), + }, + }, + }, +} + func TestEncode(t *testing.T) { for _, ca := range cases { t.Run(ca.name, func(t *testing.T) {