rename MPEG2Video into MPEG1Video, MPEG2Audio into MPEG1Audio

This commit is contained in:
aler9
2023-08-05 14:01:16 +02:00
committed by Alessandro Ros
parent 4e789ff6b9
commit 33bc1c874b
20 changed files with 120 additions and 84 deletions

View File

@@ -0,0 +1,56 @@
package rtpmpeg1audio
import (
"testing"
"github.com/pion/rtp"
"github.com/stretchr/testify/require"
)
func TestDecode(t *testing.T) {
for _, ca := range cases {
t.Run(ca.name, func(t *testing.T) {
d := &Decoder{}
d.Init()
var frames [][]byte
var err error
for _, pkt := range ca.pkts {
frames, _, err = d.Decode(pkt)
}
require.NoError(t, err)
require.Equal(t, ca.frames, frames)
})
}
}
func FuzzDecoder(f *testing.F) {
f.Fuzz(func(t *testing.T, a []byte, b []byte) {
d := &Decoder{}
d.Init()
d.Decode(&rtp.Packet{
Header: rtp.Header{
Version: 2,
PayloadType: 14,
SequenceNumber: 17645,
Timestamp: 2289527317,
SSRC: 0x9dbb7812,
},
Payload: a,
})
d.Decode(&rtp.Packet{
Header: rtp.Header{
Version: 2,
PayloadType: 14,
SequenceNumber: 17646,
Timestamp: 2289527317,
SSRC: 0x9dbb7812,
},
Payload: b,
})
})
}