mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
@@ -425,7 +425,8 @@ func (s *SessionDescription) unmarshalMediaDescription(value string) error {
|
|||||||
if fields[0] != "video" &&
|
if fields[0] != "video" &&
|
||||||
fields[0] != "audio" &&
|
fields[0] != "audio" &&
|
||||||
fields[0] != "application" &&
|
fields[0] != "application" &&
|
||||||
!strings.HasPrefix(fields[0], "application/") {
|
!strings.HasPrefix(fields[0], "application/") &&
|
||||||
|
fields[0] != "metadata" {
|
||||||
return fmt.Errorf("%w `%v`", errSDPInvalidValue, fields[0])
|
return fmt.Errorf("%w `%v`", errSDPInvalidValue, fields[0])
|
||||||
}
|
}
|
||||||
newMediaDesc.MediaName.Media = fields[0]
|
newMediaDesc.MediaName.Media = fields[0]
|
||||||
|
@@ -2600,6 +2600,63 @@ var cases = []struct {
|
|||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"issue gortsplib/474",
|
||||||
|
[]byte("m=metadata 0 RTP/AVP 98\r\n" +
|
||||||
|
"c=IN IP4 0.0.0.0\r\n" +
|
||||||
|
"b=AS:1000\r\n" +
|
||||||
|
"a=rtpmap:98 METADATA/90000\r\n" +
|
||||||
|
"a=control:track2\r\n" +
|
||||||
|
"a=x-onvif-track:track2\r\n" +
|
||||||
|
"a=x-bufferdelay:1.000000\r\n"),
|
||||||
|
[]byte("v=0\r\n" +
|
||||||
|
"o= 0 0 \r\n" +
|
||||||
|
"m=metadata 0 RTP/AVP 98\r\n" +
|
||||||
|
"c=IN IP4 0.0.0.0\r\n" +
|
||||||
|
"b=AS:1000\r\n" +
|
||||||
|
"a=rtpmap:98 METADATA/90000\r\n" +
|
||||||
|
"a=control:track2\r\n" +
|
||||||
|
"a=x-onvif-track:track2\r\n" +
|
||||||
|
"a=x-bufferdelay:1.000000\r\n"),
|
||||||
|
SessionDescription{
|
||||||
|
MediaDescriptions: []*psdp.MediaDescription{{
|
||||||
|
MediaName: psdp.MediaName{
|
||||||
|
Media: "metadata",
|
||||||
|
Protos: []string{"RTP", "AVP"},
|
||||||
|
Formats: []string{"98"},
|
||||||
|
},
|
||||||
|
ConnectionInformation: &psdp.ConnectionInformation{
|
||||||
|
NetworkType: "IN",
|
||||||
|
AddressType: "IP4",
|
||||||
|
Address: &psdp.Address{
|
||||||
|
Address: "0.0.0.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Bandwidth: []psdp.Bandwidth{{
|
||||||
|
Type: "AS",
|
||||||
|
Bandwidth: 1000,
|
||||||
|
}},
|
||||||
|
Attributes: []psdp.Attribute{
|
||||||
|
{
|
||||||
|
Key: "rtpmap",
|
||||||
|
Value: "98 METADATA/90000",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "control",
|
||||||
|
Value: "track2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "x-onvif-track",
|
||||||
|
Value: "track2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Key: "x-bufferdelay",
|
||||||
|
Value: "1.000000",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUnmarshal(t *testing.T) {
|
func TestUnmarshal(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user