restore compatibility with go 1.17

This commit is contained in:
aler9
2023-01-08 12:17:14 +01:00
parent c9d7b05308
commit 8912d5e643
30 changed files with 1689 additions and 1613 deletions

View File

@@ -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) {