Skip to content

Commit

Permalink
support SDPs without session name
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Oct 9, 2023
1 parent 1b3eb75 commit 462a5b8
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pkg/sdp/sdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,5 @@ func (s *SessionDescription) Unmarshal(byts []byte) error {
}
}

if s.SessionName == "" {
return fmt.Errorf("session name not present")
}

return nil
}
92 changes: 92 additions & 0 deletions pkg/sdp/sdp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2433,6 +2433,98 @@ var cases = []struct {
},
},
},
{
"issue mediamtx/2473",
[]byte("v=0\r\n" +
"o=- 38990265062388 38990265062388 IN IP4 192.168.1.10\r\n" +
"a=range:npt=0-\r\n" +
"m=video 0 RTP/AVP 96\r\n" +
"c=IN IP4 0.0.0.0\r\n" +
"a=rtpmap:96 H265/90000 \r\n" +
"a=fmtp:96 sprop-vps=QAEMAf//AWAAAAMAAAMAAAMAAAMAlqwJ; " +
"sprop-sps=QgEBAWAAAAMAAAMAAAMAAAMAlqABICAFEWNrkk5TNwEBAQQAAEZQAAV+QoQ=; sprop-pps=RAHA8vAiQA==\r\n" +
"a=control:trackID=3\r\n" +
"m=audio 0 RTP/AVP 8\r\n" +
"a=control:trackID=4\r\n" +
"a=rtpmap:8 PCMA/8000\r\n"),
[]byte("v=0\r\n" +
"o=- 38990265062388 38990265062388 IN IP4 192.168.1.10\r\n" +
"a=range:npt=0-\r\n" +
"m=video 0 RTP/AVP 96\r\n" +
"c=IN IP4 0.0.0.0\r\n" +
"a=rtpmap:96 H265/90000 \r\n" +
"a=fmtp:96 sprop-vps=QAEMAf//AWAAAAMAAAMAAAMAAAMAlqwJ; " +
"sprop-sps=QgEBAWAAAAMAAAMAAAMAAAMAlqABICAFEWNrkk5TNwEBAQQAAEZQAAV+QoQ=; sprop-pps=RAHA8vAiQA==\r\n" +
"a=control:trackID=3\r\n" +
"m=audio 0 RTP/AVP 8\r\n" +
"a=control:trackID=4\r\n" +
"a=rtpmap:8 PCMA/8000\r\n"),
SessionDescription{
Origin: psdp.Origin{
Username: "-",
SessionID: 38990265062388,
SessionVersion: 38990265062388,
NetworkType: "IN",
AddressType: "IP4",
UnicastAddress: "192.168.1.10",
},
SessionName: "",
Attributes: []psdp.Attribute{
{
Key: "range",
Value: "npt=0-",
},
},
MediaDescriptions: []*psdp.MediaDescription{
{
MediaName: psdp.MediaName{
Media: "video",
Protos: []string{"RTP", "AVP"},
Formats: []string{"96"},
},
ConnectionInformation: &psdp.ConnectionInformation{
NetworkType: "IN",
AddressType: "IP4",
Address: &psdp.Address{
Address: "0.0.0.0",
},
},
Attributes: []psdp.Attribute{
{
Key: "rtpmap",
Value: "96 H265/90000 ",
},
{
Key: "fmtp",
Value: "96 sprop-vps=QAEMAf//AWAAAAMAAAMAAAMAAAMAlqwJ; " +
"sprop-sps=QgEBAWAAAAMAAAMAAAMAAAMAlqABICAFEWNrkk5TNwEBAQQAAEZQAAV+QoQ=; sprop-pps=RAHA8vAiQA==",
},
{
Key: "control",
Value: "trackID=3",
},
},
},
{
MediaName: psdp.MediaName{
Media: "audio",
Protos: []string{"RTP", "AVP"},
Formats: []string{"8"},
},
Attributes: []psdp.Attribute{
{
Key: "control",
Value: "trackID=4",
},
{
Key: "rtpmap",
Value: "8 PCMA/8000",
},
},
},
},
},
},
}

func TestUnmarshal(t *testing.T) {
Expand Down

0 comments on commit 462a5b8

Please sign in to comment.