The overlay feed (rendering, MJPEG broadcaster, RTSP) is now gated by a
master toggle persisted in the state file alongside the RTSP toggles.
A fresh install serves only the raw feed and skips the JPEG decode /
draw / re-encode loop entirely, saving the bulk of the per-frame CPU.
Pipeline changes:
- runOverlay() drops frames when the master is off, before any decode
- New SetOverlayEnabled() clears the overlay broadcaster's cached frame
and stops the ffmpeg overlay process when disabling
- The user's RTSP overlay preference is tracked in overlayRTSPPref so
it survives master toggles. RTSP overlay only runs when both master
overlay and the user preference are on.
- State struct renamed pipelineState; adds overlay_enabled field. Old
state files load cleanly (missing field defaults to false).
Web changes:
- New /api/overlay endpoint (GET/POST) for the master toggle
- /stream/overlay and /snapshot/overlay return 503 when master is off,
so img elements show broken instead of hanging on an empty stream
- /overlay full-screen page redirects to / when master is off
- mjpeg.Broadcaster.Clear() empties the cached last frame so snapshots
do not serve stale data after a feed is disabled
UI:
- Master "Overlay feed" toggle in the stats bar
- Overlay card is hidden when master is off; img src is removed so the
browser does not retry against a 503 endpoint
- RTSP overlay sub-toggle is disabled in the UI when master is off
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>