修复rtmp推流结束时, stack先释放, 后续解析剩余的流, 造成rtmp stack 回调流时空指针问题

This commit is contained in:
yangjiechina
2024-07-05 22:03:13 +08:00
parent 217605072e
commit a8f26f74df
2 changed files with 16 additions and 11 deletions

View File

@@ -89,11 +89,13 @@ func (s *Session) Input(conn net.Conn, data []byte) error {
func (s *Session) Close() {
//session/conn/stack相关引用, go释放不了...手动赋值为nil
s.conn = nil
//释放协议栈
if s.stack != nil {
s.stack.Close()
s.stack = nil
}
defer func() {
if s.stack != nil {
s.stack.Close()
s.stack = nil
}
}()
//还没到publish/play
if s.handle == nil {