-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE improvements: prevent candidate pair removal #166
Labels
Comments
Here's how a basic usage of this API looks. const pc = new RTCPeerConnection({iceServers: [/* ice servers */]});
const transceiver = pc.addTransceiver("video");
await pc.setLocalDescription();
// Option 1 - cancelable event
transceiver.sender.transport.iceTransport.oncandidatepairremoval = (e) => {
if (e.candidatePair.local.type === 'relay' || e.candidatePair.local.protocol === 'udp') {
e.preventDefault();
}
// else e.candidatePair gets removed
};
// Option 2 - removable attribute
transceiver.sender.transport.iceTransport.oncandidatepairadded = (e) => {
if (e.candidatePair.local.type === 'relay' || e.candidatePair.local.protocol === 'udp') {
e.candidatePair.removable = false;
}
};
// Option 3 - idleTimeout attribute
transceiver.sender.transport.iceTransport.oncandidatepairadded = (e) => {
if (e.candidatePair.local.type === 'relay' || e.candidatePair.local.protocol === 'udp') {
e.candidatePair.idleTimeout = Number.MAX_SAFE_INTEGER;
}
}; |
This issue had an associated resolution in WebRTC May 2023 meeting – 16 May 2023 (IceController: Prevent removal of candidate pairs w3c/webrtc-extensions#166):
|
This was referenced Jun 12, 2023
This issue was discussed in WebRTC June 2023 meeting – 27 June 2023 (Issue #166 PR #168 - prevent candidate pair removal) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background: An incremental approach for improving ICE control capabilities was discussed at the WebRTC WG April 2023 interim meeting. This issue relates to the first in a series of proposed improvements.
Problem: Applications should be able to maintain multiple candidate pairs by preventing the removal of candidate pairs that are not in active use for transport. This is necessary for applications that want to maintain redundant candidate pairs for connection resiliency, or move traffic to an alternate route based on the network cost or other factors.
Proposal: This could be achieved a few different ways.
Cancelable event for candidate pair removal
When the ICE agent has decided to prune a candidate pair (eg. due to inactivity), the user agent fires a
cancelable
event to let the application know that a candidate pair is about to be removed. The application can prevent the removal from happening by callingpreventDefault()
on the event. If not prevented, the ICE agent is free to prune the candidate pair.The API looks like
This approach to preventing the user agent from taking default action has a precedent in touch event and form submit event.
This event conveys to the application exactly when the removal is to occur, and allows the decision to permit or prevent removal to be deferred until it actually needs to be made. It sidesteps any race conditions that may have to be averted with the other options.
Change automatic behaviour -
removable
attributeThe application can change the ICE agent's automatic behaviour by setting an attribute (or an internal slot, through a method) to prevent a candidate pair from being automatically pruned by the ICE agent.
Change automatic behaviour -
idleTimeout
attributeThis attribute leaves it up to the ICE agent to manage the candidate pair lifecycle, but with input from the application. The ICE agent may prune the candidate pair if no data or ICE check activity has occurred on the candidate pair within the timeout duration.
The
idleTimeout
can achieve the same effect asremovable
, with max value meaning never remove, and 0 meaning the ICE agent can prune freely.This option gives more control than a
removable
attribute - an application can choose to simply extend the duration for which an inactive candidate pair is retained.Another benefit is that there is no need for a new API to let the application prune candidate pairs. The ICE agent will eventually clean up inactive candidate pairs after the timeout. The user agent could also enfore policies on how long of a timeout the application is allowed to set.
The text was updated successfully, but these errors were encountered: