diff --git a/internal/core/rtmp_source.go b/internal/core/rtmp_source.go index 2fad83df..9a4793b2 100644 --- a/internal/core/rtmp_source.go +++ b/internal/core/rtmp_source.go @@ -156,8 +156,6 @@ func (s *rtmpSource) runInner() bool { tracks = append(tracks, audioTrack) } - s.log(logger.Info, "ready") - res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{ Source: s, Tracks: tracks, @@ -166,6 +164,8 @@ func (s *rtmpSource) runInner() bool { return err } + s.log(logger.Info, "ready") + defer func() { s.parent.OnSourceStaticSetNotReady(pathSourceStaticSetNotReadyReq{Source: s}) }() diff --git a/internal/core/rtsp_source.go b/internal/core/rtsp_source.go index 753b001e..465b7a26 100644 --- a/internal/core/rtsp_source.go +++ b/internal/core/rtsp_source.go @@ -175,8 +175,6 @@ func (s *rtspSource) runInner() bool { return true } - s.log(logger.Info, "ready") - res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{ Source: s, Tracks: conn.Tracks(), @@ -186,6 +184,8 @@ func (s *rtspSource) runInner() bool { return true } + s.log(logger.Info, "ready") + defer func() { s.parent.OnSourceStaticSetNotReady(pathSourceStaticSetNotReadyReq{Source: s}) }()