Skip to content

feat: Request an in-place ICE restart when the network changes - #17720

Merged
bgrozev merged 3 commits into
jitsi:masterfrom
bgrozev:ice-restart-mobile-network-change
Aug 18, 2026
Merged

feat: Request an in-place ICE restart when the network changes#17720
bgrozev merged 3 commits into
jitsi:masterfrom
bgrozev:ice-restart-mobile-network-change

Conversation

@bgrozev

@bgrozev bgrozev commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Fires an in-place ICE restart proactively when the mobile OS reports a network change, instead of waiting for ICE to fail. This is a mobile-only extension of the in-place ICE restart feature added in feat: Add enableIceRestart config option #17700.
  • Adds config flag enableIceRestartOnNetworkChange (on by default, has no effect unless enableIceRestart is also on).
  • Debounces rapid network flapping and rate-limits requests, on top of jicofo's own rate limit.
  • Treats a reconnect after an offline gap as a network change, even when the address ends up identical to the pre-outage baseline (for example the same DHCP lease on the same wifi network) — the interface genuinely went down and came back up, so any ICE candidates gathered on it are stale regardless of whether the address string still matches.

Verified end to end on a real device against a stage standalone: wifi off for about 20 seconds, then back on to the same network and address. The bridge completed the resulting in-place restart (generation 2, cutover in 801ms).

Fires an in-place ICE restart on its own when the mobile OS reports a
network change, instead of waiting for ICE to actually fail. This is a
proactive make-before-break: the bridge keeps carrying media on the
established path while the new one comes up, so it is safe to request
whenever the local address the session was set up on may have gone
stale.

Wired into base/conference/middleware.native.ts on SET_NETWORK_INFO.
New config flag enableIceRestartOnNetworkChange (on by default, has no
effect unless enableIceRestart is also on).

Treats a reconnect after an offline gap as a network change, even when
the address ends up identical to the pre-outage baseline (for example
the same DHCP lease on the same wifi network). Without this, a device
that goes offline and reconnects to the same network would look
unchanged to a plain address comparison, even though the interface
genuinely went down and came back up, and any ICE candidates gathered
on it are stale regardless of whether the address string still matches.

Verified end to end on a real device against a boris3 standalone: wifi
off for about 20 seconds, then back on to the same network and address.
JVB completed the resulting in-place restart (generation 2, cutover in
801ms). See ~/claude/ice-restart/mobile-test-2026-08-13-wifi-toggle.md
for the full transcript.
jitsi-ci Bot pushed a commit to jitsi/jitsi-pr-tests-pages that referenced this pull request Aug 13, 2026
// another restart.
lastRequestTime = Date.now();

conference.restartJvbIce('network-change')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the reason string is only used in the log message, the IQ sent has 'ice-restart' irrespective of the reason passed. Looks like that is intentional. Should we create a enum for the restart reasons?

…ange trigger

Follow-up from a review comment on this PR. lib-jitsi-meet now exposes
IceRestartReason (jitsi/lib-jitsi-meet#3089) on JitsiMeetJS.constants
(jitsi/lib-jitsi-meet#3090, since this package ships no types and every
other enum jitsi-meet consumes goes through JitsiMeetJS.constants/
.errors/.events rather than a direct module import).

Re-export it as JitsiIceRestartReason and pass
JitsiIceRestartReason.NETWORK_CHANGE instead of the bare string
'network-change'. Also tighten IJitsiConference.restartJvbIce's
signature to the known reason values, since the shim interface still
can't import lib-jitsi-meet's real type.
jitsi-ci Bot pushed a commit to jitsi/jitsi-pr-tests-pages that referenced this pull request Aug 18, 2026
@bgrozev
bgrozev merged commit 97150e2 into jitsi:master Aug 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants