Default overlay to enabled in HTML mode
Fresh installs now show the overlay over the live picture in the web UI without any server-side overlay processing. Previously the overlay defaulted to off entirely. The change is just to loadState()'s default values; both fields are still read from the state file when present, so existing users who have explicitly toggled either setting keep their preference. Users upgrading from before overlay_baked existed get the new HTML default (was implicitly baked before). Behavior with the new defaults on a fresh install: - Master overlay: on - Overlay type: HTML (baked off) - runOverlay() drops frames without decoding (no CPU overhead) - /stream/overlay and /snapshot/overlay return 503 (HTML mode) - RTSP overlay process does not start - Web UI shows stats overlaid via CSS on top of the raw stream Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,12 +25,14 @@ RTSP feeds can be toggled on/off at runtime from the web UI without restarting t
|
||||
|
||||
The **raw HTTP stream and snapshot** (`/stream/raw`, `/snapshot/raw`, and the mjpg_streamer-compatible `/webcam/?action=stream` and `/webcam/?action=snapshot`) are always available, regardless of any runtime toggle. They never carry the overlay. Point OctoPrint's Classic Webcam plugin at these URLs for reliable live feeds and snapshot capture.
|
||||
|
||||
The **overlay feed** is a separate master toggle (rendering, MJPEG, RTSP). It defaults to **off** so a fresh install serves only the raw feed and consumes no CPU for the overlay. The RTSP overlay sub-toggle is preserved across master toggles but the ffmpeg process only runs when both are on.
|
||||
The **overlay feed** is a separate master toggle (rendering, MJPEG, RTSP). It defaults to **on** in **HTML** mode, so a fresh install shows the stats over the live picture in the web UI without doing any server-side JPEG decode/draw/encode. The RTSP overlay sub-toggle is preserved across master toggles but the ffmpeg process only runs when the master is on **and** the overlay type is baked.
|
||||
|
||||
**Overlay type** can be switched at runtime between two modes:
|
||||
|
||||
- **Baked**: the overlay is rendered server-side and burned into the JPEG frames. Works with OctoPrint, VLC, and any RTSP consumer. Higher CPU cost.
|
||||
- **HTML**: the overlay is drawn client-side over the raw stream. No JPEG decode/draw/encode on the server. Web-only — `/stream/overlay` and `/snapshot/overlay` return 503 and the RTSP overlay process is stopped.
|
||||
- **HTML** (default): the overlay is drawn client-side over the raw stream. No JPEG decode/draw/encode on the server. Web-only — `/stream/overlay` and `/snapshot/overlay` return 503 and the RTSP overlay process is stopped.
|
||||
- **Baked**: the overlay is rendered server-side and burned into the JPEG frames. Required for OctoPrint, VLC, or any consumer that expects the stats inside the video stream. Higher CPU cost.
|
||||
|
||||
All toggles — master overlay, overlay type, and both RTSP feed states — persist in the state file (`/var/lib/octocam/feeds.json` by default) and survive reboots.
|
||||
|
||||
## Architecture
|
||||
|
||||
|
||||
@@ -126,8 +126,10 @@ type pipelineState struct {
|
||||
}
|
||||
|
||||
func (p *Pipeline) loadState() pipelineState {
|
||||
// Default: overlay off, baked overlay if enabled, both RTSP feeds off.
|
||||
state := pipelineState{OverlayBaked: true}
|
||||
// Defaults on first run: overlay enabled in HTML mode (no server-side
|
||||
// JPEG decode/draw/encode), both RTSP feeds off. The state file overrides
|
||||
// any field it specifies, so toggles set by the user persist across reboots.
|
||||
state := pipelineState{OverlayEnabled: true}
|
||||
data, err := os.ReadFile(p.cfg.StateFile)
|
||||
if err != nil {
|
||||
return state // file absent = first run, use defaults
|
||||
|
||||
Reference in New Issue
Block a user