diff --git a/pkg/sdp/sdp.go b/pkg/sdp/sdp.go index 693a60aa..53a2754f 100644 --- a/pkg/sdp/sdp.go +++ b/pkg/sdp/sdp.go @@ -181,7 +181,7 @@ func unmarshalConnectionInformation(value string) (*psdp.ConnectionInformation, // Set according to currently registered with IANA // https://tools.ietf.org/html/rfc4566#section-8.2.6 - if i := indexOf(fields[0], []string{"IN"}); i == -1 { + if i := indexOf(strings.ToUpper(fields[0]), []string{"IN"}); i == -1 { return nil, fmt.Errorf("%w `%v`", errSDPInvalidValue, fields[0]) } @@ -197,7 +197,7 @@ func unmarshalConnectionInformation(value string) (*psdp.ConnectionInformation, } return &psdp.ConnectionInformation{ - NetworkType: fields[0], + NetworkType: strings.ToUpper(fields[0]), AddressType: fields[1], Address: connAddr, }, nil diff --git a/pkg/sdp/sdp_test.go b/pkg/sdp/sdp_test.go index 2a4af36f..0f43d5d1 100644 --- a/pkg/sdp/sdp_test.go +++ b/pkg/sdp/sdp_test.go @@ -1764,6 +1764,68 @@ var cases = []struct { }, }, }, + { + "fritz box 660 cable", + []byte("v=0\n" + + "o=- 224 1 IN IP4 192.168.178.1\n" + + "s=SatIPServer:1 0,0,4\n" + + "t=0 0\n" + + "m=video 0 RTP/AVP 33\n" + + "c=In IP4 0.0.0.0\n" + + "a=control:stream=1\n" + + "a=fmtp:33 ver=1.2;src=1;tuner=1,240,1,7,112,,dvbc,,,,6900,34;pids=0,16,17,18,20\n" + + "a=sendonly\n"), + []byte("v=0\r\n" + + "o=- 224 1 IN IP4 192.168.178.1\r\n" + + "s=SatIPServer:1 0,0,4\r\n" + + "t=0 0\r\n" + + "m=video 0 RTP/AVP 33\r\n" + + "c=IN IP4 0.0.0.0\r\n" + + "a=control:stream=1\r\n" + + "a=fmtp:33 ver=1.2;src=1;tuner=1,240,1,7,112,,dvbc,,,,6900,34;pids=0,16,17,18,20\r\n" + + "a=sendonly\r\n"), + SessionDescription{ + Origin: psdp.Origin{ + Username: "-", + SessionID: 224, + SessionVersion: 1, + NetworkType: "IN", + AddressType: "IP4", + UnicastAddress: "192.168.178.1", + }, + SessionName: "SatIPServer:1 0,0,4", + TimeDescriptions: []psdp.TimeDescription{{}}, + MediaDescriptions: []*psdp.MediaDescription{ + { + MediaName: psdp.MediaName{ + Media: "video", + Protos: []string{"RTP", "AVP"}, + Formats: []string{"33"}, + }, + ConnectionInformation: &psdp.ConnectionInformation{ + NetworkType: "IN", + AddressType: "IP4", + Address: &psdp.Address{ + Address: "0.0.0.0", + }, + }, + Attributes: []psdp.Attribute{ + { + Key: "control", + Value: "stream=1", + }, + { + Key: "fmtp", + Value: "33 ver=1.2;src=1;tuner=1,240,1,7,112,,dvbc,,,,6900,34;pids=0,16,17,18,20", + }, + { + Key: "sendonly", + }, + }, + }, + }, + }, + }, } func TestUnmarshal(t *testing.T) {