Repository navigation
Gather ICE candidates continually by default - #1299
Open
evgeniy-gera-it wants to merge 1 commit into
Open
evgeniy-gera-it wants to merge 1 commit into
evgeniy-gera-it wants to merge 1 commit into
Conversation
evgeniy-gera-it
requested review from
changt,
cloudwebrtc,
hiroshihorie and
xianshijing-lk
as code owners
November 19, 2026 09:28
Member
|
Thanks for the PR! Looks good overall. Could you sign the CLA so we can move forward? |
hiroshihorie
approved these changes
Nov 19, 2026
Add RTCConfiguration.continualGatheringPolicy and default it to gather_continually in the engine, as the Swift, Android and JS SDKs do. libwebrtc gathers once by default, so after a network change new candidates only arrived with an ICE restart. An explicit value from the app is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SXscSZpJKcfcD8fbpAsCtB
evgeniy-gera-it
force-pushed
the
continual-gathering-policy
branch
from
November 20, 2026 17:11
5ec527a to
137efc2
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
RTCConfiguration.continualGatheringPolicy(RTCContinualGatheringPolicy.gatherOnce/gatherContinually), withcopyWithandtoMap('gather_once'/'gather_continually', the values flutter_webrtc reads).Engine._buildRtcConfigurationsetsgatherContinuallywhen the app leaves the field unset. An explicit value from the app is kept.Why
The other LiveKit SDKs create peer connections with continual gathering:
Sources/LiveKit/Extensions/RTCConfiguration.swift#L25src/room/RTCEngine.ts#L908room/RTCEngine.kt#L1136-L1142The Flutter SDK never sends the key, so flutter_webrtc keeps the libwebrtc default,
GATHER_ONCE(api/peer_connection_interface.h#L515, AndroidPeerConnection.java#L621). With gather-once, the port allocator session is stopped after the first gathering (p2p_transport_channel.cc#L2011-L2015), and a stopped session does not allocate ports for a new network (basic_port_allocator.cc#L883-L890). On a Wi-Fi to cellular switch, a mobile client then gets no candidates on the new network until the engine does an ICE restart. flutter_webrtc 1.6.3 already maps the key on iOS/macOS (FlutterWebRTCPlugin.m:2336) and Android (MethodCallHandlerImpl.java:1525).libwebrtc refuses to change the policy once gathering has started (
p2p_transport_channel.cc#L545-L553). The resume path re-applies the same configuration, so the value never changes on a live transport.Web and Windows/Linux ignore the key (the JS SDK already sets it on web).
Test
test/core/continual_gathering_policy_test.dart:toMap/copyWith; both transports are created withgather_continuallyby default, with an explicitgatherOnce, and together withiceTransportPolicy: relay.test/core/leave_action_test.dart: the configuration re-applied on resume keeps the policy.flutter test,flutter analyze,dart analyze web/,dart format,import_sorter,check_versionpass locally.Changeset:
.changes/continual-gathering-policy(minor, added).Closes #1298