You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(go2rtc): codec-aware registration + live re-register on codec change (#374)
Reolink 810A (and anything else that streams H.265) couldn't negotiate
WebRTC: go2rtc offered H.265 video, browsers only accept VP8/VP9/H.264/AV1,
SDP failed with "codecs not matched". go2rtc's answer is a multi-source
stream with an ffmpeg H.264 fallback, but lightNVR was registering a
single raw-RTSP source and never consulting the codec field it already
had in stream_config_t.
A/B hybrid: let the user declare the codec up-front, but still auto-
correct and re-register live if they (or we) got it wrong.
Backend
- go2rtc_stream.h / .c: thread `const char *codec` through
go2rtc_stream_register(). When codec is anything other than
"h264" (case-insensitive) — including empty/unknown — append
`ffmpeg:<id>#video=h264#hardware` to the source list. Unknown is
treated as "possibly H.265" since detection only populates the codec
field after the first packet; the cost is an idle ffmpeg entry that
go2rtc never activates unless a consumer actually asks for H.264.
The composition now stacks cleanly: primary RTSP + optional AAC
(for MP4 audio muxing) + optional H.264 (for WebRTC).
- All nine call sites threaded: ensure_stream_registered_with_go2rtc,
register_all_configured_streams main+sub, sync_db_streams main+sub,
reload_stream_config, the helper in go2rtc_integration.c that runs
on stream start, and the sub-stream path in api_handlers_streams_modify.c.
- go2rtc_disabled.c stub updated to match the new signature.
- api_handlers_streams_modify.c: accept `codec` on both POST (create,
takes as initial hint) and PUT (update, triggers a stream restart so
re-registration fires immediately instead of waiting for detection).
- unified_detection_thread.c: snapshot the stored codec before calling
update_stream_video_params, and if the detected codec differs (e.g.
user declared H.264 but camera is actually HEVC), call
go2rtc_integration_reload_stream_config() with all-defaults to
re-register with the freshly-written value. This is the "users are
going to want it corrected without a program restart" piece.
Frontend
- StreamConfigModal.jsx: codec field is now an editable select
(Auto-detect / H.264 / H.265) instead of a read-only span.
- StreamsView.jsx: include lower-cased `codec` in the outbound stream
payload so the user's choice reaches the backend.
- en.json: two new keys (streamsConfig.codecAutoDetect,
streamsConfig.codecHelp) describing what the field actually does.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments