improve coverage

This commit is contained in:
aler9
2022-12-23 14:27:44 +01:00
parent d71991d929
commit 8320b1aceb
7 changed files with 297 additions and 175 deletions

View File

@@ -45,3 +45,27 @@ func TestMPEG4AudioMediaDescription(t *testing.T) {
require.Equal(t, "profile-level-id=1; mode=AAC-hbr; sizelength=13;"+
" indexlength=3; indexdeltalength=3; config=1190", fmtp)
}
func TestMPEG4AudioDecEncoder(t *testing.T) {
format := &MPEG4Audio{
PayloadTyp: 96,
Config: &mpeg4audio.Config{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
},
SizeLength: 13,
IndexLength: 3,
IndexDeltaLength: 3,
}
enc := format.CreateEncoder()
pkts, err := enc.Encode([][]byte{{0x01, 0x02, 0x03, 0x04}}, 0)
require.NoError(t, err)
require.Equal(t, format.PayloadType(), pkts[0].PayloadType)
dec := format.CreateDecoder()
byts, _, err := dec.Decode(pkts[0])
require.NoError(t, err)
require.Equal(t, [][]byte{{0x01, 0x02, 0x03, 0x04}}, byts)
}