Browse Source

support ping requests with GET_PARAMETER (#81)

pull/97/head
aler9 5 years ago
parent
commit
51e441a1cf
  1. 13
      client.go

13
client.go

@ -373,6 +373,7 @@ func (c *client) handleRequest(req *gortsplib.Request) error { @@ -373,6 +373,7 @@ func (c *client) handleRequest(req *gortsplib.Request) error {
Header: gortsplib.Header{
"CSeq": cseq,
"Public": gortsplib.HeaderValue{strings.Join([]string{
string(gortsplib.GET_PARAMETER),
string(gortsplib.DESCRIBE),
string(gortsplib.ANNOUNCE),
string(gortsplib.SETUP),
@ -384,6 +385,18 @@ func (c *client) handleRequest(req *gortsplib.Request) error { @@ -384,6 +385,18 @@ func (c *client) handleRequest(req *gortsplib.Request) error {
})
return nil
// GET_PARAMETER is used like a ping
case gortsplib.GET_PARAMETER:
c.conn.WriteResponse(&gortsplib.Response{
StatusCode: gortsplib.StatusOK,
Header: gortsplib.Header{
"CSeq": cseq,
"Content-Type": gortsplib.HeaderValue{"text/parameters"},
},
Content: []byte("\n"),
})
return nil
case gortsplib.DESCRIBE:
if c.state != clientStateInitial {
c.writeResError(cseq, gortsplib.StatusBadRequest,

Loading…
Cancel
Save