|
|
|
@ -770,14 +770,17 @@ func (c *Client) handleRequest(req *base.Request) error {
@@ -770,14 +770,17 @@ func (c *Client) handleRequest(req *base.Request) error {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case base.PLAY: |
|
|
|
|
// play can be sent twice, allow calling it even if we're already playing
|
|
|
|
|
err := c.checkState(map[state]struct{}{ |
|
|
|
|
statePrePlay: {}, |
|
|
|
|
statePlay: {}, |
|
|
|
|
}) |
|
|
|
|
if err != nil { |
|
|
|
|
c.writeResError(cseq, base.StatusBadRequest, err) |
|
|
|
|
return errStateTerminate |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if c.state == statePrePlay { |
|
|
|
|
basePath, ok := req.URL.BasePath() |
|
|
|
|
if !ok { |
|
|
|
|
c.writeResError(cseq, base.StatusBadRequest, fmt.Errorf("unable to find base path (%s)", req.URL)) |
|
|
|
@ -796,6 +799,7 @@ func (c *Client) handleRequest(req *base.Request) error {
@@ -796,6 +799,7 @@ func (c *Client) handleRequest(req *base.Request) error {
|
|
|
|
|
c.writeResError(cseq, base.StatusBadRequest, fmt.Errorf("no tracks have been setup")) |
|
|
|
|
return errStateTerminate |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// write response before setting state
|
|
|
|
|
// otherwise, in case of TCP connections, RTP packets could be sent
|
|
|
|
@ -807,7 +811,11 @@ func (c *Client) handleRequest(req *base.Request) error {
@@ -807,7 +811,11 @@ func (c *Client) handleRequest(req *base.Request) error {
|
|
|
|
|
"Session": base.HeaderValue{sessionId}, |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if c.state == statePrePlay { |
|
|
|
|
return errStatePlay |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
|
|
|
|
|
case base.RECORD: |
|
|
|
|
err := c.checkState(map[state]struct{}{ |
|
|
|
|