修复中止拉流的操作

This commit is contained in:
langhuihui
2020-05-20 09:55:39 +08:00
parent 55bd2ce785
commit 655170cb24
10 changed files with 48 additions and 46 deletions

View File

@@ -99,9 +99,11 @@ func (session *RTSP) Stop() {
session.UDPServer = nil
}
if session.Running() {
collection.Delete(session.StreamPath)
session.Cancel()
}
if session.Stream != nil {
collection.Delete(session.StreamPath)
}
}
// AcceptPush 接受推流
@@ -350,7 +352,7 @@ func (session *RTSP) handleRequest(req *Request) {
res.Status = "Invalid URL"
return
}
streamPath := strings.TrimPrefix(url.Path,"/")
streamPath := strings.TrimPrefix(url.Path, "/")
session.SDPRaw = req.Body
session.SDPMap = ParseSDP(req.Body)
@@ -361,7 +363,7 @@ func (session *RTSP) handleRequest(req *Request) {
session.AudioSpecificConfig = sdp.Config
Printf("audio codec[%s]\n", session.ACodec)
}
if sdp, ok = session.SDPMap["video"];ok {
if sdp, ok = session.SDPMap["video"]; ok {
session.VControl = sdp.Control
session.VCodec = sdp.Codec
session.SPS = sdp.SpropParameterSets[0]