mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
examples: fix memory leak in server-h264-save-to-disk
This commit is contained in:
@@ -46,8 +46,8 @@ func (sh *serverHandler) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionClo
|
|||||||
sh.mutex.Lock()
|
sh.mutex.Lock()
|
||||||
defer sh.mutex.Unlock()
|
defer sh.mutex.Unlock()
|
||||||
|
|
||||||
// allow someone else to publish
|
|
||||||
sh.publisher = nil
|
sh.publisher = nil
|
||||||
|
sh.mpegtsMuxer.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// called after receiving an ANNOUNCE request.
|
// called after receiving an ANNOUNCE request.
|
||||||
@@ -58,9 +58,8 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
|||||||
defer sh.mutex.Unlock()
|
defer sh.mutex.Unlock()
|
||||||
|
|
||||||
if sh.publisher != nil {
|
if sh.publisher != nil {
|
||||||
return &base.Response{
|
sh.publisher.Close()
|
||||||
StatusCode: base.StatusBadRequest,
|
sh.mpegtsMuxer.close()
|
||||||
}, fmt.Errorf("someone is already publishing")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the H264 track
|
// find the H264 track
|
||||||
|
Reference in New Issue
Block a user