Skip to content

fix: recover WebRTC session config for cameras asleep at setup - #905

Open
hacctarr wants to merge 2 commits into
SecKatie:masterfrom
hacctarr:fix/webrtc-session-config-retry
Open

hacctarr wants to merge 2 commits into
SecKatie:masterfrom
hacctarr:fix/webrtc-session-config-retry

Conversation

@hacctarr

@hacctarr hacctarr commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Second of three related WebRTC fixes. Depends on #904, and since I cannot push a base branch to this repo the diff here shows #904's commit as well. Mine is the second commit, fix: recover WebRTC session config for cameras asleep at setup.

The session config was fetched once during platform setup and never retried, so any camera asleep at that moment kept a null config for the life of the integration and raised "WebRTC session configuration not available yet" on every attempt. For battery cameras that is most of them, most of the time.

It could not recover on its own either: the frontend asks for the config before it asks for an offer, and the offer handler was the only place the wakeup ran.

Falls back to public STUN so the sync hook can answer, and refreshes the real config out of band. wake_and_fetch_config polls get_stream_info six times over 20 seconds, because a battery camera keeps reporting iot-state 0 for the first few seconds after it wakes.

A battery camera has to be woken before it joins its signaling channel,
and the channel buffers nothing, so the single offer we sent was simply
gone by the time the camera was listening. The live view stayed black and
nothing in the log said why.

Wake DEVICEMGMT models first, then resend the offer and candidates every
4 seconds until one comes back answered.

Cameras still take 5 to 20 seconds to start streaming. That is the wakeup
itself, not this loop.
The session config was fetched once during platform setup and never
retried, so any camera asleep at that moment kept a null config for the
lifetime of the integration and raised "WebRTC session configuration not
available yet" on every attempt. For battery cameras that is most of them,
most of the time.

It could not recover on its own either: the frontend asks for the config
before it asks for an offer, and the offer handler was the only place the
wakeup ran.

Fall back to public STUN so the sync hook can answer, and refresh the real
config out of band. wake_and_fetch_config polls get_stream_info six times
over 20 seconds, because a battery camera keeps reporting iot-state 0 for
the first few seconds after it wakes.
@CLAassistant

CLAassistant commented Aug 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants