From d25d27a0ee7e5251f72bf866f54232ae2f084920 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Tue, 6 Sep 2022 12:43:10 +0300 Subject: [PATCH] Fix SDP parsing for noname camera --- pkg/streamer/media.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/streamer/media.go b/pkg/streamer/media.go index 49366ba6..2b86826b 100644 --- a/pkg/streamer/media.go +++ b/pkg/streamer/media.go @@ -5,6 +5,7 @@ import ( "github.com/pion/sdp/v3" "strconv" "strings" + "unicode" ) const ( @@ -242,7 +243,8 @@ func UnmarshalCodec(md *sdp.MediaDescription, payloadType string) *Codec { ss := strings.Split(attr.Value[i+1:], "/") c.Name = strings.ToUpper(ss[0]) - c.ClockRate = uint32(atoi(ss[1])) + // fix tailing space: `a=rtpmap:96 H264/90000 ` + c.ClockRate = uint32(atoi(strings.TrimRightFunc(ss[1], unicode.IsSpace))) if len(ss) == 3 && ss[2] == "2" { c.Channels = 2