Skip to content

Commit

Permalink
support SETUP with mode=record in uppercase (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Jul 18, 2020
1 parent ce5e11f commit e42b135
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
8 changes: 4 additions & 4 deletions server-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e42b135

Please sign in to comment.