mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
simplify format.Unmarshal; improve tests (#631)
This commit is contained in:
@@ -124,109 +124,3 @@ func TestMPEG4AudioDecEncoder(t *testing.T) {
|
||||
require.Equal(t, [][]byte{{0x01, 0x02, 0x03, 0x04}}, byts)
|
||||
})
|
||||
}
|
||||
|
||||
func FuzzUnmarshalMPEG4AudioGeneric(f *testing.F) {
|
||||
f.Fuzz(func(
|
||||
_ *testing.T,
|
||||
a bool,
|
||||
b string,
|
||||
c bool,
|
||||
d string,
|
||||
e bool,
|
||||
f string,
|
||||
g bool,
|
||||
h string,
|
||||
i bool,
|
||||
j string,
|
||||
k bool,
|
||||
l string,
|
||||
m bool,
|
||||
n string,
|
||||
) {
|
||||
ma := map[string]string{}
|
||||
|
||||
if a {
|
||||
ma["streamtype"] = b
|
||||
}
|
||||
|
||||
if c {
|
||||
ma["mode"] = d
|
||||
}
|
||||
|
||||
if e {
|
||||
ma["profile-level-id"] = f
|
||||
}
|
||||
|
||||
if g {
|
||||
ma["config"] = h
|
||||
}
|
||||
|
||||
if i {
|
||||
ma["sizelength"] = j
|
||||
}
|
||||
|
||||
if k {
|
||||
ma["indexlength"] = l
|
||||
}
|
||||
|
||||
if m {
|
||||
ma["indexdeltalength"] = n
|
||||
}
|
||||
|
||||
fo, err := Unmarshal("audio", 96, "MPEG4-generic/48000/2", ma) //nolint:errcheck
|
||||
if err == nil {
|
||||
fo.(*MPEG4Audio).GetConfig()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func FuzzUnmarshalMPEG4AudioLATM(f *testing.F) {
|
||||
f.Fuzz(func(
|
||||
_ *testing.T,
|
||||
a bool,
|
||||
b string,
|
||||
c bool,
|
||||
d string,
|
||||
e bool,
|
||||
f string,
|
||||
g bool,
|
||||
h string,
|
||||
i bool,
|
||||
j string,
|
||||
k bool,
|
||||
l string,
|
||||
) {
|
||||
ma := map[string]string{}
|
||||
|
||||
if a {
|
||||
ma["profile-level-id"] = b
|
||||
}
|
||||
|
||||
if c {
|
||||
ma["bitrate"] = d
|
||||
}
|
||||
|
||||
if e {
|
||||
ma["cpresent"] = f
|
||||
}
|
||||
|
||||
if g {
|
||||
ma["config"] = h
|
||||
}
|
||||
|
||||
if i {
|
||||
ma["object"] = j
|
||||
}
|
||||
|
||||
if k {
|
||||
ma["sbr-enabled"] = l
|
||||
}
|
||||
|
||||
fo, err := Unmarshal("audio", 96, "MP4A-LATM/48000/2", ma)
|
||||
if err == nil {
|
||||
fo.(*MPEG4Audio).RTPMap()
|
||||
fo.(*MPEG4Audio).FMTP()
|
||||
fo.(*MPEG4Audio).GetConfig()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user