|
|
|
|
@ -77,7 +77,6 @@ type Path struct {
@@ -77,7 +77,6 @@ type Path struct {
|
|
|
|
|
setupPlayRequests []client.SetupPlayReq |
|
|
|
|
source source.Source |
|
|
|
|
sourceTracks gortsplib.Tracks |
|
|
|
|
sourceTrackStartingPoints []streamproc.TrackStartingPoint |
|
|
|
|
sp *streamproc.StreamProc |
|
|
|
|
readers *readersMap |
|
|
|
|
onDemandCmd *externalcmd.Cmd |
|
|
|
|
@ -101,7 +100,6 @@ type Path struct {
@@ -101,7 +100,6 @@ type Path struct {
|
|
|
|
|
clientRecord chan client.RecordReq |
|
|
|
|
clientPause chan client.PauseReq |
|
|
|
|
clientRemove chan client.RemoveReq |
|
|
|
|
spSetStartingPoint chan streamproc.SetStartingPointReq |
|
|
|
|
terminate chan struct{} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -146,7 +144,6 @@ func New(
@@ -146,7 +144,6 @@ func New(
|
|
|
|
|
clientRecord: make(chan client.RecordReq), |
|
|
|
|
clientPause: make(chan client.PauseReq), |
|
|
|
|
clientRemove: make(chan client.RemoveReq), |
|
|
|
|
spSetStartingPoint: make(chan streamproc.SetStartingPointReq), |
|
|
|
|
terminate: make(chan struct{}), |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -228,7 +225,6 @@ outer:
@@ -228,7 +225,6 @@ outer:
|
|
|
|
|
|
|
|
|
|
case req := <-pa.extSourceSetReady: |
|
|
|
|
pa.sourceTracks = req.Tracks |
|
|
|
|
pa.sourceTrackStartingPoints = make([]streamproc.TrackStartingPoint, len(req.Tracks)) |
|
|
|
|
pa.sp = streamproc.New(pa, len(req.Tracks)) |
|
|
|
|
pa.onSourceSetReady() |
|
|
|
|
req.Res <- source.ExtSetReadyRes{SP: pa.sp} |
|
|
|
|
@ -269,9 +265,6 @@ outer:
@@ -269,9 +265,6 @@ outer:
|
|
|
|
|
pa.clientsWg.Done() |
|
|
|
|
close(req.Res) |
|
|
|
|
|
|
|
|
|
case req := <-pa.spSetStartingPoint: |
|
|
|
|
pa.onSPSetStartingPoint(req) |
|
|
|
|
|
|
|
|
|
case <-pa.terminate: |
|
|
|
|
pa.exhaustChannels() |
|
|
|
|
break outer |
|
|
|
|
@ -330,7 +323,6 @@ outer:
@@ -330,7 +323,6 @@ outer:
|
|
|
|
|
close(pa.clientRecord) |
|
|
|
|
close(pa.clientPause) |
|
|
|
|
close(pa.clientRemove) |
|
|
|
|
close(pa.spSetStartingPoint) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (pa *Path) exhaustChannels() { |
|
|
|
|
@ -397,12 +389,6 @@ func (pa *Path) exhaustChannels() {
@@ -397,12 +389,6 @@ func (pa *Path) exhaustChannels() {
|
|
|
|
|
|
|
|
|
|
pa.clientsWg.Done() |
|
|
|
|
close(req.Res) |
|
|
|
|
|
|
|
|
|
case _, ok := <-pa.spSetStartingPoint: |
|
|
|
|
if !ok { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}() |
|
|
|
|
@ -657,13 +643,7 @@ func (pa *Path) onClientPlay(req client.PlayReq) {
@@ -657,13 +643,7 @@ func (pa *Path) onClientPlay(req client.PlayReq) {
|
|
|
|
|
pa.clients[req.Client] = clientStatePlay |
|
|
|
|
pa.readers.add(req.Client) |
|
|
|
|
|
|
|
|
|
// clone
|
|
|
|
|
cl := make([]streamproc.TrackStartingPoint, len(pa.sourceTrackStartingPoints)) |
|
|
|
|
for k, v := range pa.sourceTrackStartingPoints { |
|
|
|
|
cl[k] = v |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
req.Res <- client.PlayRes{cl} // nolint:govet
|
|
|
|
|
req.Res <- client.PlayRes{TrackInfos: pa.sp.TrackInfos()} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (pa *Path) onClientAnnounce(req client.AnnounceReq) { |
|
|
|
|
@ -713,7 +693,6 @@ func (pa *Path) onClientRecord(req client.RecordReq) {
@@ -713,7 +693,6 @@ func (pa *Path) onClientRecord(req client.RecordReq) {
|
|
|
|
|
pa.clients[req.Client] = clientStateRecord |
|
|
|
|
pa.onSourceSetReady() |
|
|
|
|
|
|
|
|
|
pa.sourceTrackStartingPoints = make([]streamproc.TrackStartingPoint, len(pa.sourceTracks)) |
|
|
|
|
pa.sp = streamproc.New(pa, len(pa.sourceTracks)) |
|
|
|
|
|
|
|
|
|
req.Res <- client.RecordRes{SP: pa.sp, Err: nil} |
|
|
|
|
@ -740,14 +719,6 @@ func (pa *Path) onClientPause(req client.PauseReq) {
@@ -740,14 +719,6 @@ func (pa *Path) onClientPause(req client.PauseReq) {
|
|
|
|
|
close(req.Res) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (pa *Path) onSPSetStartingPoint(req streamproc.SetStartingPointReq) { |
|
|
|
|
if req.SP != pa.sp { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pa.sourceTrackStartingPoints[req.TrackID] = req.StartingPoint |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (pa *Path) scheduleSourceClose() { |
|
|
|
|
if !pa.hasExternalSource() || !pa.conf.SourceOnDemand || pa.source == nil { |
|
|
|
|
return |
|
|
|
|
@ -855,11 +826,6 @@ func (pa *Path) OnClientPause(req client.PauseReq) {
@@ -855,11 +826,6 @@ func (pa *Path) OnClientPause(req client.PauseReq) {
|
|
|
|
|
pa.clientPause <- req |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// OnSPSetStartingPoint is called by streamproc.StreamProc.
|
|
|
|
|
func (pa *Path) OnSPSetStartingPoint(req streamproc.SetStartingPointReq) { |
|
|
|
|
pa.spSetStartingPoint <- req |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// OnSPFrame is called by streamproc.StreamProc.
|
|
|
|
|
func (pa *Path) OnSPFrame(trackID int, streamType gortsplib.StreamType, payload []byte) { |
|
|
|
|
pa.readers.forwardFrame(trackID, streamType, payload) |
|
|
|
|
|