feat: add stream_enabled config to control ffmpeg pulling and optimize infer startup script

This commit is contained in:
2026-05-09 09:48:43 +08:00
parent 97a77d4745
commit 966ef512ab
3 changed files with 30 additions and 0 deletions

View File

@@ -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 {