mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 23:02:45 +08:00
58 lines
1.0 KiB
Go
58 lines
1.0 KiB
Go
package format //nolint:dupl
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/pion/rtp"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestVP8ttributes(t *testing.T) {
|
|
format := &VP8{
|
|
PayloadTyp: 99,
|
|
}
|
|
require.Equal(t, "VP8", format.Codec())
|
|
require.Equal(t, 90000, format.ClockRate())
|
|
require.Equal(t, true, format.PTSEqualsDTS(&rtp.Packet{}))
|
|
}
|
|
|
|
func TestVP8DecEncoder(t *testing.T) {
|
|
format := &VP8{}
|
|
|
|
enc, err := format.CreateEncoder()
|
|
require.NoError(t, err)
|
|
|
|
pkts, err := enc.Encode([]byte{0x01, 0x02, 0x03, 0x04})
|
|
require.NoError(t, err)
|
|
require.Equal(t, format.PayloadType(), pkts[0].PayloadType)
|
|
|
|
dec, err := format.CreateDecoder()
|
|
require.NoError(t, err)
|
|
|
|
byts, err := dec.Decode(pkts[0])
|
|
require.NoError(t, err)
|
|
require.Equal(t, []byte{0x01, 0x02, 0x03, 0x04}, byts)
|
|
}
|
|
|
|
func FuzzUnmarshalVP8(f *testing.F) {
|
|
f.Fuzz(func(
|
|
_ *testing.T,
|
|
a bool,
|
|
b string,
|
|
c bool,
|
|
d string,
|
|
) {
|
|
ma := map[string]string{}
|
|
|
|
if a {
|
|
ma["max-fr"] = b
|
|
}
|
|
|
|
if c {
|
|
ma["max-fs"] = d
|
|
}
|
|
|
|
Unmarshal("audio", 96, "VP8/90000", ma) //nolint:errcheck
|
|
})
|
|
}
|