mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-05 23:56:54 +08:00
do not allow closed static sources to set a path as ready
This commit is contained in:
@@ -92,6 +92,7 @@ type pathSourceStaticSetReadyRes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type pathSourceStaticSetReadyReq struct {
|
type pathSourceStaticSetReadyReq struct {
|
||||||
|
Source sourceStatic
|
||||||
Tracks gortsplib.Tracks
|
Tracks gortsplib.Tracks
|
||||||
Res chan pathSourceStaticSetReadyRes
|
Res chan pathSourceStaticSetReadyRes
|
||||||
}
|
}
|
||||||
@@ -348,8 +349,12 @@ outer:
|
|||||||
}
|
}
|
||||||
|
|
||||||
case req := <-pa.sourceStaticSetReady:
|
case req := <-pa.sourceStaticSetReady:
|
||||||
|
if req.Source == pa.source {
|
||||||
pa.sourceSetReady(req.Tracks)
|
pa.sourceSetReady(req.Tracks)
|
||||||
req.Res <- pathSourceStaticSetReadyRes{Stream: pa.stream}
|
req.Res <- pathSourceStaticSetReadyRes{Stream: pa.stream}
|
||||||
|
} else {
|
||||||
|
req.Res <- pathSourceStaticSetReadyRes{Err: fmt.Errorf("terminated")}
|
||||||
|
}
|
||||||
|
|
||||||
case req := <-pa.sourceStaticSetNotReady:
|
case req := <-pa.sourceStaticSetNotReady:
|
||||||
if req.Source == pa.source {
|
if req.Source == pa.source {
|
||||||
|
@@ -159,6 +159,7 @@ func (s *rtmpSource) runInner() bool {
|
|||||||
s.log(logger.Info, "ready")
|
s.log(logger.Info, "ready")
|
||||||
|
|
||||||
res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
|
res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
|
||||||
|
Source: s,
|
||||||
Tracks: tracks,
|
Tracks: tracks,
|
||||||
})
|
})
|
||||||
if res.Err != nil {
|
if res.Err != nil {
|
||||||
|
@@ -178,6 +178,7 @@ func (s *rtspSource) runInner() bool {
|
|||||||
s.log(logger.Info, "ready")
|
s.log(logger.Info, "ready")
|
||||||
|
|
||||||
res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
|
res := s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
|
||||||
|
Source: s,
|
||||||
Tracks: conn.Tracks(),
|
Tracks: conn.Tracks(),
|
||||||
})
|
})
|
||||||
if res.Err != nil {
|
if res.Err != nil {
|
||||||
|
Reference in New Issue
Block a user