mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
examples: add missing mutex in OnSetup (#729)
This commit is contained in:
@@ -147,6 +147,9 @@ func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sh.mutex.Lock()
|
||||||
|
defer sh.mutex.Unlock()
|
||||||
|
|
||||||
// no one is publishing yet
|
// no one is publishing yet
|
||||||
if sh.stream == nil {
|
if sh.stream == nil {
|
||||||
return &base.Response{
|
return &base.Response{
|
||||||
|
@@ -108,6 +108,9 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
|||||||
func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
|
func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
|
||||||
log.Printf("setup request")
|
log.Printf("setup request")
|
||||||
|
|
||||||
|
sh.mutex.Lock()
|
||||||
|
defer sh.mutex.Unlock()
|
||||||
|
|
||||||
// no one is publishing yet
|
// no one is publishing yet
|
||||||
if sh.stream == nil {
|
if sh.stream == nil {
|
||||||
return &base.Response{
|
return &base.Response{
|
||||||
|
@@ -107,6 +107,9 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
|||||||
func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
|
func (sh *serverHandler) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) {
|
||||||
log.Printf("setup request")
|
log.Printf("setup request")
|
||||||
|
|
||||||
|
sh.mutex.Lock()
|
||||||
|
defer sh.mutex.Unlock()
|
||||||
|
|
||||||
// no one is publishing yet
|
// no one is publishing yet
|
||||||
if sh.stream == nil {
|
if sh.stream == nil {
|
||||||
return &base.Response{
|
return &base.Response{
|
||||||
|
Reference in New Issue
Block a user