fix info.TimeScale assign bug

This commit is contained in:
nareix 2016-06-08 15:29:20 +08:00
parent 4a48b5df35
commit d5075b55b2

View File

@ -2,6 +2,7 @@ package sdp
import ( import (
"strings" "strings"
"fmt"
"strconv" "strconv"
"encoding/hex" "encoding/hex"
"encoding/base64" "encoding/base64"
@ -61,13 +62,18 @@ func Decode(content string) (infos []Info) {
keyval = strings.Split(field, "/") keyval = strings.Split(field, "/")
if len(keyval) >= 2 { if len(keyval) >= 2 {
key := keyval[0] key := keyval[0]
info.TimeScale, _ = strconv.Atoi(keyval[1])
switch key { switch key {
case "MPEG4-GENERIC": case "MPEG4-GENERIC":
info.Type = av.AAC info.Type = av.AAC
case "H264": case "H264":
info.Type = av.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, ";") keyval = strings.Split(field, ";")
if len(keyval) > 1 { if len(keyval) > 1 {