From d5075b55b2b99d6f4e539ae2df74d91fa603f2f7 Mon Sep 17 00:00:00 2001 From: nareix Date: Wed, 8 Jun 2016 15:29:20 +0800 Subject: [PATCH] fix info.TimeScale assign bug --- sdp/parser.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdp/parser.go b/sdp/parser.go index e3db4d3..6b83b46 100644 --- a/sdp/parser.go +++ b/sdp/parser.go @@ -2,6 +2,7 @@ package sdp import ( "strings" + "fmt" "strconv" "encoding/hex" "encoding/base64" @@ -61,13 +62,18 @@ func Decode(content string) (infos []Info) { keyval = strings.Split(field, "/") if len(keyval) >= 2 { key := keyval[0] - info.TimeScale, _ = strconv.Atoi(keyval[1]) switch key { case "MPEG4-GENERIC": info.Type = av.AAC case "H264": info.Type = av.H264 } + if i, err := strconv.Atoi(keyval[1]); err == nil { + info.TimeScale = i + } + if false { + fmt.Println("sdp:", keyval[1], info.TimeScale) + } } keyval = strings.Split(field, ";") if len(keyval) > 1 {