Browse Source

support SETUP with mode=record in uppercase (#40)

pull/52/head
aler9 6 years ago
parent
commit
e42b135f2c
  1. 2
      go.mod
  2. 4
      go.sum
  3. 8
      server-client.go

2
go.mod

@ -5,7 +5,7 @@ go 1.13 @@ -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-20200718113358-4754822be147
github.com/aler9/gortsplib v0.0.0-20200718114958-1d365c8c9369
github.com/pion/sdp v1.3.0
github.com/stretchr/testify v1.5.1
gopkg.in/alecthomas/kingpin.v2 v2.2.6

4
go.sum

@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo @@ -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-20200718113358-4754822be147 h1:1rPmAAdNf9bdxXWuY9PSko6eFMjwLiwlTXbOukG0cFg=
github.com/aler9/gortsplib v0.0.0-20200718113358-4754822be147/go.mod h1:17dcA4Qak5TLqgun8OR0wnSbFQIg4cvYVSf1nbCt+qU=
github.com/aler9/gortsplib v0.0.0-20200718114958-1d365c8c9369 h1:7t451d8q3yYtUwQM6GqJPCek13BC0yeh0tQqWrxyuck=
github.com/aler9/gortsplib v0.0.0-20200718114958-1d365c8c9369/go.mod h1:17dcA4Qak5TLqgun8OR0wnSbFQIg4cvYVSf1nbCt+qU=
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/pion/rtcp v1.2.3 h1:2wrhKnqgSz91Q5nzYTO07mQXztYPtxL8a0XOss4rJqA=

8
server-client.go

@ -491,7 +491,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { @@ -491,7 +491,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool {
return false
}
rtpPort, rtcpPort := th.GetPorts("client_port")
rtpPort, rtcpPort := th.Ports("client_port")
if rtpPort == 0 || rtcpPort == 0 {
c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not have valid client ports (%v)", req.Header["Transport"]))
return false
@ -578,7 +578,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { @@ -578,7 +578,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool {
// record
case clientStateAnnounce, clientStatePreRecord:
if _, ok := th["mode=record"]; !ok {
if strings.ToLower(th.Value("mode")) != "record" {
c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not contain mode=record"))
return false
}
@ -606,7 +606,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { @@ -606,7 +606,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool {
return false
}
rtpPort, rtcpPort := th.GetPorts("client_port")
rtpPort, rtcpPort := th.Ports("client_port")
if rtpPort == 0 || rtcpPort == 0 {
c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not have valid client ports (%s)", req.Header["Transport"]))
return false
@ -657,7 +657,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { @@ -657,7 +657,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool {
return false
}
interleaved := th.GetValue("interleaved")
interleaved := th.Value("interleaved")
if interleaved == "" {
c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not contain the interleaved field"))
return false

Loading…
Cancel
Save