Skip to content

Commit 980369e

Browse files
committed
Expose ice_aggressive_nomination option
1 parent b240306 commit 980369e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/ex_webrtc/peer_connection.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ defmodule ExWebRTC.PeerConnection do
596596
ice_servers: config.ice_servers,
597597
ice_transport_policy: config.ice_transport_policy,
598598
ip_filter: config.ice_ip_filter,
599+
aggressive_nomination: config.ice_aggressive_nomination,
599600
ports: config.ice_port_range,
600601
on_data: nil
601602
]

lib/ex_webrtc/peer_connection/configuration.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ defmodule ExWebRTC.PeerConnection.Configuration do
157157
* `ice_transport_policy` - which type of ICE candidates should be used. Defaults to `:all`.
158158
* `ice_ip_filter` - filter applied when gathering local candidates. By default, all IP addresses are accepted.
159159
* `ice_port_range` - range of ports that ICE will use for gathering host candidates. Defaults to ephemeral ports.
160+
* `ice_aggressive_nomination` - whether ICE agent should use aggressive nomination. By default, ICE agent
161+
relies on regular nomination defined in RFC 8445. However, some WebRTC implementations require
162+
controlling side to nominate the pair before they can start sending data (e.g. Pion, Firefox).
163+
This can result in longer, connection establishment time as regular nomination nominates only one pair,
164+
at the very end of the whole connection establishment process. To mitigate this issue, you can eitehr add empty ICE candidate (this will indicate that there won't be further
165+
remote candidates and once all connectivity checks pass, ICE will nominate the pair), or use aggressive nomination.
166+
Defaults to false.
160167
* `audio_codecs` and `video_codecs` - lists of audio and video codecs to negotiate. By default these are equal to
161168
`default_audio_codecs/0` and `default_video_codecs/0`. To extend the list with your own codecs, do
162169
`audio_codecs: Configuration.default_audio_codecs() ++ my_codecs`.
@@ -181,6 +188,7 @@ defmodule ExWebRTC.PeerConnection.Configuration do
181188
ice_transport_policy: :relay | :all,
182189
ice_ip_filter: ICEAgent.ip_filter(),
183190
ice_port_range: Enumerable.t(non_neg_integer()),
191+
ice_aggressive_nomination: boolean(),
184192
audio_codecs: [RTPCodecParameters.t()] | [audio_codec_name()],
185193
video_codecs: [RTPCodecParameters.t()] | [video_codec_name()],
186194
features: [feature()],
@@ -200,6 +208,7 @@ defmodule ExWebRTC.PeerConnection.Configuration do
200208
ice_transport_policy: :relay | :all,
201209
ice_ip_filter: (:inet.ip_address() -> boolean()) | nil,
202210
ice_port_range: Enumerable.t(non_neg_integer()),
211+
ice_aggressive_nomination: boolean(),
203212
audio_codecs: [RTPCodecParameters.t()],
204213
video_codecs: [RTPCodecParameters.t()],
205214
audio_extensions: [Extmap.t()],
@@ -218,6 +227,7 @@ defmodule ExWebRTC.PeerConnection.Configuration do
218227
ice_servers: [],
219228
ice_transport_policy: :all,
220229
ice_port_range: [0],
230+
ice_aggressive_nomination: false,
221231
audio_codecs: @default_audio_codecs,
222232
video_codecs: @default_video_codecs,
223233
features: @default_features

0 commit comments

Comments
 (0)