Skip to content

Commit

Permalink
Add support for more protos
Browse files Browse the repository at this point in the history
BFCP, UDT and IX
  • Loading branch information
FizikRoot authored and Sean-Der committed Mar 28, 2024
1 parent 2edc074 commit 84cf380
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ func unmarshalMediaDescription(l *lexer) (stateFn, error) {
// https://tools.ietf.org/html/rfc4566#section-5.14
// https://tools.ietf.org/html/rfc4975#section-8.1
for _, proto := range strings.Split(field, "/") {
if !anyOf(proto, "UDP", "RTP", "AVP", "SAVP", "SAVPF", "TLS", "DTLS", "SCTP", "AVPF", "TCP", "MSRP") {
if !anyOf(proto, "UDP", "RTP", "AVP", "SAVP", "SAVPF", "TLS", "DTLS", "SCTP", "AVPF", "TCP", "MSRP", "BFCP", "UDT", "IX") {
return nil, fmt.Errorf("%w `%v`", errSDPInvalidNumericValue, field)
}
newMediaDesc.MediaName.Protos = append(newMediaDesc.MediaName.Protos, proto)
Expand Down
20 changes: 20 additions & 0 deletions unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ const (
"a=rtcp-fb:97 nack\r\n" +
"a=rtcp-fb:97 nack pli\r\n"

MediaBfcpSDP = TimingSDP +
"m=application 3238 UDP/BFCP *\r\n" +
"a=sendrecv\r\n" +
"a=setup:actpass\r\n" +
"a=connection:new\r\n" +
"a=floorctrl:c-s\r\n"

MediaCubeSDP = TimingSDP +
"m=application 2455 UDP/UDT/IX *\r\n" +
"a=ixmap:0 ping\r\n" +
"a=ixmap:2 xccp\r\n"

CanonicalUnmarshalSDP = "v=0\r\n" +
"o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5\r\n" +
"s=SDP Seminar\r\n" +
Expand Down Expand Up @@ -300,6 +312,14 @@ func TestRoundTrip(t *testing.T) {
Name: "CanonicalUnmarshal",
SDP: CanonicalUnmarshalSDP,
},
{
Name: "MediaBfcpSDP",
SDP: MediaBfcpSDP,
},
{
Name: "MediaCubeSDP",
SDP: MediaCubeSDP,
},
} {
test := test
t.Run(test.Name, func(t *testing.T) {
Expand Down

0 comments on commit 84cf380

Please sign in to comment.