examples: add missing mutex in OnSetup (#729)

This commit is contained in:
Alessandro Ros
2025-03-23 16:20:54 +01:00
committed by GitHub
parent fcb018151b
commit c8f4a0b0d3
3 changed files with 9 additions and 0 deletions

View File

@@ -107,6 +107,9 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
log.Printf("setup request")
sh.mutex.Lock()
defer sh.mutex.Unlock()
// no one is publishing yet
if sh.stream == nil {
return &base.Response{