mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 07:37:07 +08:00
client: send TEARDOWN even when PLAY or RECORD have not been sent yet
This commit is contained in:
14
client.go
14
client.go
@@ -529,19 +529,22 @@ func (c *Client) runInner() error {
|
||||
}
|
||||
|
||||
func (c *Client) doClose() {
|
||||
if c.state != clientStatePlay && c.state != clientStateRecord && c.conn != nil {
|
||||
c.connCloserStop()
|
||||
}
|
||||
|
||||
if c.state == clientStatePlay || c.state == clientStateRecord {
|
||||
c.playRecordStop(true)
|
||||
}
|
||||
|
||||
if c.baseURL != nil {
|
||||
c.do(&base.Request{
|
||||
Method: base.Teardown,
|
||||
URL: c.baseURL,
|
||||
}, true, false)
|
||||
}
|
||||
|
||||
c.nconn.Close()
|
||||
c.nconn = nil
|
||||
c.conn = nil
|
||||
} else if c.nconn != nil {
|
||||
c.connCloserStop()
|
||||
if c.nconn != nil {
|
||||
c.nconn.Close()
|
||||
c.nconn = nil
|
||||
c.conn = nil
|
||||
@@ -1259,6 +1262,7 @@ func (c *Client) doSetup(
|
||||
// switch transport automatically
|
||||
if c.effectiveTransport == nil &&
|
||||
c.Transport == nil {
|
||||
c.baseURL = baseURL
|
||||
return c.trySwitchingProtocol2(medi, baseURL)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user