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
{{ message }}
Repository navigation
[Agent] WebRTC: fix ICE gathering/trickle and remove dead signaling code #659
web/js/components/preact/WebRTCVideoCell.jsx contains a commented-out trickle-ICE block at ~732-743, which POSTs to /api/webrtc/ice, a route that doesn't exist in LightNVR or go2rtc's HTTP API. Its comment says "If trickle ICE is needed, uncomment the code below". Signaling today is a single HTTP POST {go2rtcBaseUrl}/api/webrtc?src=... with the SDP offer (~814).
Two related cleanups:
The log says "waiting for ICE gathering...", but it isn't clear whether the code actually waits for iceGatheringState === 'complete' before sending the offer. If it doesn't, the offer may carry no host or srflx candidates. If it does, connecting is slow on networks where gathering stalls (unreachable STUN/TURN gives a timeout of several seconds).
pc.onicecandidate and nearby code log every candidate with console.log for each cell, which is noisy on a 16-camera grid.
Expected behavior and scope
Find out and document what the current flow does: offer sent before or after gathering, and measured time-to-first-frame on LAN.
Pick one, and explain why in the PR:
(a) Real trickle ICE over go2rtc's WebSocket signaling (/api/ws?src=..., which accepts webrtc/offer and webrtc/candidate messages), proxied through the existing /go2rtc/ path; or
(b) Bounded gathering: send the offer when gathering completes or after a short timeout (for example 1 s) with whatever candidates exist.
Delete the dead commented block, and move per-candidate logs behind a debug flag (follow existing debug-log conventions if any).
Acceptance criteria
Time-to-first-frame on LAN is no worse, and is better when STUN is unreachable (simulate with a bogus ICE server from /api/ice-servers).
WebRTC still connects through the go2rtc proxy path, both with and without authentication.
No dead commented code is left, and the console is quiet by default.
Validation
cd web && npx vite build, npm run lint, npm test.
Manual check in Chrome and Firefox against a running instance. Include before and after timings in the PR.
Constraints and rollback
Frontend only, unless option (a) needs a WebSocket proxy route the backend doesn't already forward. In that case, say so in the PR and keep the backend change minimal.
Activity
WebRTC: bounded ICE gathering and remove dead signaling code (#659)