Skip to content

0.7.16 — Cold-start keyframe gate

Choose a tag to compare

@privatecoder privatecoder released this 25 Jun 22:07
· 10 commits to master since this release

Fixes the Home Assistant / go2rtc live-view reconnect loop that could appear after a restart: on a cold start the cached RTSP fast path now briefly waits for the camera's first real keyframe before serving, instead of exposing a keepalive-only stream that go2rtc rejects during the camera's P2P connect.

What's new / changed

  • New option startup_keyframe_wait_secs (global default + per-camera override, range 0–60, default 5, 0 = disabled). On the first open of a stream since Neolink started (no real keyframe cached yet), the cached fast path waits up to this many seconds for the camera's first real keyframe and then serves the session straight on live video. The trade-off: the first open of each camera after a restart shows a brief "connecting" (usually the ~2–3 s P2P connect) instead of an instant placeholder. Warm opens and 0 are unchanged.

Fixes

  • Cold-start keyframe gate stops the post-restart reconnect storm. After a (re)start a camera needs ~2–3 s to connect over P2P. The cached fast path used to answer the RTSP client and serve a low-rate keepalive placeholder immediately, before any real frame existed — and go2rtc bails after ~300 ms of keepalive, tipping it into a rapid reconnect storm that doesn't self-heal even once the camera is up. The gate makes go2rtc's first PLAY get real video, removing the trigger. If the wait expires (camera truly offline), it falls back to the previous keepalive placeholder, so offline-open still works.
  • The cached-path camera-setup wait is now bounded (20 s, matching the slow path) and replies cleanly when cancelled, on error, or on timeout — it can't leave an RTSP setup callback blocked.

Notes

  • No configuration changes are required; the gate is on by default.
  • This complements the parameter-set + backpressure fixes in 0.7.15. The remaining amplifier — go2rtc reconnecting aggressively once tripped — is best removed on the Home Assistant side by giving go2rtc a single named stream to own (one producer per camera, with backoff) rather than a raw rtsp:// URL per card. See docs/home-assistant.md → "Live view connects then drops in a reconnect loop".
  • Validated by cargo build + the workspace test suite (42 tests, incl. new gate/config tests) and an independent code review; confirm against your own cameras after updating.

References

Docker image

docker pull ghcr.io/privatecoder/neolink:0.7.16