Reconnect streams in-process; fix for_window IPC rules

Root cause of the periodic drops (found via the new logs): mpv was
exiting cleanly (err=nil, exit 0) with its status line at 100% — i.e.
end-of-stream. UniFi Protect closes some cameras' RTSP connections every
20-40s; with --keep-open=no --idle=no mpv treated that as the file
ending, exited, and the supervisor relaunched it ~3s later (the visible
drop).

- Add --loop-file=inf so mpv reopens the stream the instant it EOFs,
  in the same process and window: sub-second recovery, no teardown,
  no supervisor bounce. The supervisor now only fires for real crashes.
- Clean up the logged exit "reason": strip ANSI escapes and skip mpv's
  transient A/V status prints, so a genuine error surfaces instead of
  "\x1b[KV: 00:00:35 / 00:00:35 (100%)". Tests cover the parsing.

Also fold in the for_window IPC fix: sway's IPC parser splits comma-
joined command lists at the top level and does not fold the continuation
into for_window (unlike the config-file parser), so the map-time
placement rules errored with "Only views can have borders" and never
installed. Register each command separately; drop the redundant
border none (the kiosk config already sets default_border none).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Levi Woodard
2026-07-02 12:54:02 -05:00
parent be1b53ae04
commit ed9814ab4e
4 changed files with 105 additions and 21 deletions

View File

@@ -278,6 +278,12 @@ pegged, work through:
thing to check when one tile restarts repeatedly. A camera whose `video-codec`
is `hevc` can't hardware-decode on a Pi 4 and often stutters/exits under load —
switch it to H.264 in Protect or give the tile the `low` substream.
UniFi Protect also *closes* some cameras' RTSP connections periodically (every
20-40s on certain models), which mpv sees as a clean end-of-stream. mpv is run
with `--loop-file=inf` so it reconnects in-process (sub-second, no window
teardown) rather than exiting and being relaunched — so this is normally
invisible. If a camera still blips on reconnect, it's dropping unusually often;
check its codec/bitrate in Protect.
- **`status` can't reach the daemon** (`control.sock: no such file`) — the wall
is running as a *different user* than your SSH session (check
`ps -o user= -p "$(pgrep -x sway)"` vs `id`). Re-run `install.sh <your-user>`