Browse Source

do not allow closed static sources to set a path as ready

pull/523/head
aler9 4 years ago
parent
commit
a2ff0d455f
  1. 9
      internal/core/path.go
  2. 1
      internal/core/rtmp_source.go
  3. 1
      internal/core/rtsp_source.go

9
internal/core/path.go

@ -92,6 +92,7 @@ type pathSourceStaticSetReadyRes struct { @@ -92,6 +92,7 @@ type pathSourceStaticSetReadyRes struct {
}
type pathSourceStaticSetReadyReq struct {
Source sourceStatic
Tracks gortsplib.Tracks
Res chan pathSourceStaticSetReadyRes
}
@ -348,8 +349,12 @@ outer: @@ -348,8 +349,12 @@ outer:
}
case req := <-pa.sourceStaticSetReady:
pa.sourceSetReady(req.Tracks)
req.Res <- pathSourceStaticSetReadyRes{Stream: pa.stream}
if req.Source == pa.source {
pa.sourceSetReady(req.Tracks)
req.Res <- pathSourceStaticSetReadyRes{Stream: pa.stream}
} else {
req.Res <- pathSourceStaticSetReadyRes{Err: fmt.Errorf("terminated")}
}
case req := <-pa.sourceStaticSetNotReady:
if req.Source == pa.source {

1
internal/core/rtmp_source.go

@ -159,6 +159,7 @@ func (s *rtmpSource) runInner() bool { @@ -159,6 +159,7 @@ func (s *rtmpSource) runInner() bool {
s.log(logger.Info, "ready")
res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
Source: s,
Tracks: tracks,
})
if res.Err != nil {

1
internal/core/rtsp_source.go

@ -178,6 +178,7 @@ func (s *rtspSource) runInner() bool { @@ -178,6 +178,7 @@ func (s *rtspSource) runInner() bool {
s.log(logger.Info, "ready")
res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
Source: s,
Tracks: conn.Tracks(),
})
if res.Err != nil {

Loading…
Cancel
Save