fix: 提前释放stream发生crash问题

This commit is contained in:
ydajiang
2024-12-26 22:12:03 +08:00
parent 70b3e68d6d
commit ca72b5662d
2 changed files with 7 additions and 1 deletions

View File

@@ -126,7 +126,6 @@ func recoverStreams() ([]*Stream, []*Sink) {
if !ok {
Sugar.Infof("删除过期的推流会话 stream: %s", stream.ID)
closedStreams = append(closedStreams, stream)
stream.Close(true, false)
continue
}

View File

@@ -187,3 +187,10 @@ func CreateRequestFromDialog(dialog sip.Request, method sip.RequestMethod) sip.R
func (s *Stream) CreateRequestFromDialog(method sip.RequestMethod) sip.Request {
return CreateRequestFromDialog(s.Dialog, method)
}
func CloseStream(streamId StreamID, ms bool) {
stream := StreamManager.Remove(streamId)
if stream != nil {
stream.Close(true, ms)
}
}