mirror of
https://github.com/aler9/gortsplib
synced 2025-09-27 19:42:11 +08:00
examples: prevent redundant checks in OnSetup when recording (#731)
This commit is contained in:
@@ -107,6 +107,13 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
||||
func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
|
||||
log.Printf("setup request")
|
||||
|
||||
// SETUP is used by both readers and publishers. In case of publishers, just return StatusOK.
|
||||
if ctx.Session.State() == gortsplib.ServerSessionStatePreRecord {
|
||||
return &base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
}, nil, nil
|
||||
}
|
||||
|
||||
sh.mutex.RLock()
|
||||
defer sh.mutex.RUnlock()
|
||||
|
||||
|
Reference in New Issue
Block a user