diff --git a/go.mod b/go.mod index 6d34c59..ad0ae3a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect - github.com/aler9/gortsplib v0.0.0-20200313131835-13b7bffbba39 + github.com/aler9/gortsplib v0.0.0-20200410165230-e085d60e5979 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/yaml.v2 v2.2.2 gortc.io/sdp v0.17.0 diff --git a/go.sum b/go.sum index d6ed149..6c82f7f 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/aler9/gortsplib v0.0.0-20200313131835-13b7bffbba39 h1:9Vb9v7wBSp+mAtqb+5IJQRarQlycp2ksrv4wRrsMPZI= -github.com/aler9/gortsplib v0.0.0-20200313131835-13b7bffbba39/go.mod h1:YiIgmmv0ELkWUy11Jj2h5AgfqLCpy8sIX/l9MmS8+uw= +github.com/aler9/gortsplib v0.0.0-20200410165230-e085d60e5979 h1:8W+hVHm0tpNubksM0tPXb0+XS9RVA/PY3l/unU2xQDU= +github.com/aler9/gortsplib v0.0.0-20200410165230-e085d60e5979/go.mod h1:YiIgmmv0ELkWUy11Jj2h5AgfqLCpy8sIX/l9MmS8+uw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= diff --git a/stream.go b/stream.go index 7858c5e..c9c226c 100644 --- a/stream.go +++ b/stream.go @@ -196,8 +196,13 @@ func (s *stream) run() { return } - if sx, ok := res.Header["Session"]; ok && len(sx) == 1 { - conn.SetSession(sx[0]) + if sxRaw, ok := res.Header["Session"]; ok && len(sxRaw) == 1 { + sx, err := gortsplib.ReadHeaderSession(sxRaw[0]) + if err != nil { + s.log("ERR: unable to parse session: %s", err) + return + } + conn.SetSession(sx.Session) } res, err = writeReqReadRes(conn, &gortsplib.Request{ @@ -383,8 +388,13 @@ func (s *stream) runUdp(conn *gortsplib.ConnClient) { return } - if sx, ok := res.Header["Session"]; ok && len(sx) == 1 { - conn.SetSession(sx[0]) + if sxRaw, ok := res.Header["Session"]; ok && len(sxRaw) == 1 { + sx, err := gortsplib.ReadHeaderSession(sxRaw[0]) + if err != nil { + s.log("ERR: unable to parse session: %s", err) + return + } + conn.SetSession(sx.Session) } tsRaw, ok := res.Header["Transport"] @@ -546,8 +556,13 @@ func (s *stream) runTcp(conn *gortsplib.ConnClient) { return } - if sx, ok := res.Header["Session"]; ok && len(sx) == 1 { - conn.SetSession(sx[0]) + if sxRaw, ok := res.Header["Session"]; ok && len(sxRaw) == 1 { + sx, err := gortsplib.ReadHeaderSession(sxRaw[0]) + if err != nil { + s.log("ERR: unable to parse session: %s", err) + return + } + conn.SetSession(sx.Session) } if res.StatusCode != 200 {