This commit is contained in:
Andrey Semochkin
2021-05-08 23:07:59 +03:00
parent 338966ed52
commit 5adbbcc01f
5 changed files with 190 additions and 22 deletions

View File

@@ -18,6 +18,7 @@ type Session struct {
type Media struct {
AVType string
Type av.CodecType
FPS int
TimeScale int
Control string
Rtpmap int
@@ -37,6 +38,10 @@ func Parse(content string) (sess Session, medias []Media) {
for _, line := range strings.Split(content, "\n") {
line = strings.TrimSpace(line)
////Camera [BUG] a=x-framerate: 25
if strings.Contains(line, "x-framerate") {
line = strings.Replace(line, " ", "", -1)
}
typeval := strings.SplitN(line, "=", 2)
if len(typeval) == 2 {
fields := strings.SplitN(typeval[1], " ", 2)
@@ -78,6 +83,8 @@ func Parse(content string) (sess Session, medias []Media) {
media.Control = val
case "rtpmap":
media.Rtpmap, _ = strconv.Atoi(val)
case "x-framerate":
media.FPS, _ = strconv.Atoi(val)
}
}
keyval = strings.Split(field, "/")