feat: add stream_enabled config to control ffmpeg pulling and optimize infer startup script
This commit is contained in:
@@ -64,6 +64,23 @@ func (sm *StreamManager) applyStreams(ctx context.Context, urls []string, fps in
|
||||
sm.mu.Lock()
|
||||
defer sm.mu.Unlock()
|
||||
|
||||
// Stream enabled check
|
||||
enabled := true
|
||||
if sm.cfg != nil && !sm.cfg.StreamEnabled {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
// If disabled, stop all streams and return
|
||||
if !enabled {
|
||||
log.Println("stream: disabled by config, stopping all")
|
||||
for url, sp := range sm.processes {
|
||||
log.Printf("stream: stopping %s", url)
|
||||
sm.stopProcess(sp)
|
||||
delete(sm.processes, url)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Identify URLs to remove (present in sm.processes but not in new urls)
|
||||
toRemove := map[string]*streamProcess{}
|
||||
for url, sp := range sm.processes {
|
||||
|
||||
Reference in New Issue
Block a user