Skip to content

Conversation

@nandito
Copy link
Contributor

@nandito nandito commented Feb 17, 2025

Description

Summary:

Enable renomination if the iceRenominationOn feature is enabled.

Testing

  1. Enable iceRenominationOn
  2. Join the room 2x
  3. Go to chrome://webrtc-internals and inspect the local and remote descriptions: the renomination keyword should appear in a a=ice-options line.

Screenshots/GIFs (if applicable)

Checklist

  • My code follows the project's coding standards.
  • Prefixed the PR title and commit messages with the service or package name
  • I have written unit tests (if applicable).
  • [] I have updated the documentation (if applicable).
  • By submitting this pull request, I confirm that my contribution is made
    under the terms of the MIT license.

Additional Information

Read more about the renomination draft here: https://datatracker.ietf.org/doc/html/draft-thatcher-ice-renomination-01

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2025

🦋 Changeset detected

Latest commit: 4c8b80d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@whereby.com/media Minor
@whereby.com/core Patch
@whereby.com/browser-sdk Patch
@whereby.com/react-native-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from f3c0ae6 to 353d4ef Compare February 20, 2025 10:02
@misi-whereby
Copy link
Contributor

We may need to white list the browsers that we know that supports this feature, or
somehow fallback to original SDP if setLocalDescription gives back an error.
My guess that if the browser does not supports this ice option, then probably it will give back an error when we try to setLocalDescription /setRemoteDescription the sdp.

@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from 8754196 to 20452f0 Compare February 24, 2025 14:53
@whereby whereby deleted a comment from github-actions bot Feb 24, 2025
@whereby whereby deleted a comment from github-actions bot Feb 24, 2025
@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from 20452f0 to fb346a6 Compare February 24, 2025 15:11
@whereby whereby deleted a comment from github-actions bot Feb 24, 2025
@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from fb346a6 to 544d60c Compare February 26, 2025 10:11
@nandito nandito marked this pull request as ready for review February 26, 2025 11:08
@nandito nandito requested a review from a team February 26, 2025 11:08
@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from c85abe0 to eb32484 Compare February 27, 2025 11:00
@whereby whereby deleted a comment from github-actions bot Feb 27, 2025
@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch 3 times, most recently from df5ec5f to 4b48246 Compare February 28, 2025 13:38
@whereby whereby deleted a comment from github-actions bot Feb 28, 2025
@nandito
Copy link
Contributor Author

nandito commented Feb 28, 2025

/canary

@github-actions
Copy link
Contributor

🚀 The canary releases have been published to npm.

You can test the releases by installing the newly published versions:

yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]

@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from 4b48246 to 415b8e7 Compare March 3, 2025 11:31
@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from 415b8e7 to 5a15972 Compare March 3, 2025 14:21
@kevinwhereby
Copy link
Contributor

kevinwhereby commented Mar 10, 2025

I see all the relevant things when chrome <=> chrome, however joining with 1 chrome and 1 firefox I get this in chrome logs:
image

And my setRemoteDescription has renomination:

a=ice-options:trickle renomination

in Session.handleOffer we modify the incoming offer

 handleOffer(message: any) {
        // ...
        let sdp = message.sdp;
        if (this._iceRenominationOn) sdp = sdpModifier.enableIceRenomination(sdp);

Should check the offer for renomination before setting? Or maybe rely on the other client to send an offer with it enabled?

@nandito
Copy link
Contributor Author

nandito commented Mar 14, 2025

I see all the relevant things when chrome <=> chrome, however joining with 1 chrome and 1 firefox I get this in chrome logs: image

And my setRemoteDescription has renomination:

a=ice-options:trickle renomination

in Session.handleOffer we modify the incoming offer

 handleOffer(message: any) {
        // ...
        let sdp = message.sdp;
        if (this._iceRenominationOn) sdp = sdpModifier.enableIceRenomination(sdp);

Should check the offer for renomination before setting? Or maybe rely on the other client to send an offer with it enabled?

We don't set the renomination in the offers/answers that we signal to the other participants.
We only set it on the local side when the local participant receives or creates an offer or an answer, we set the renomination in the SDP before storing it via setRemoteDescription or setLocalDescription.
The SDP we signal to the remote participant does not have this keyword as FF did not work with a=ice-options:trickle renomination

// replace `a=ice-options:trickle` with `a=ice-options:trickle renomination`
// https://datatracker.ietf.org/doc/html/draft-thatcher-ice-renomination-00
export function enableIceRenomination(sdp: any) {
if (browserName === "firefox") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These browserName === "firefox" conditions can be problematic in FF nightly with media.navigator.mozgetusermedia.enabled = false. The webrtc-adapter returns "Not a supported browser." in this case in firefox, therefore these conditions are going to be falsy.

The related issue: webrtcHacks/adapter#1160 could fix that, but maybe it would be safer to parse the useragent on our own instead. (?)

@whereby whereby deleted a comment from github-actions bot Mar 14, 2025
@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from ad046af to c5832d4 Compare March 14, 2025 12:13
@nandito
Copy link
Contributor Author

nandito commented Mar 14, 2025

/canary

@github-actions
Copy link
Contributor

🚀 The canary releases have been published to npm.

You can test the releases by installing the newly published versions:

yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]

@jan-ivar
Copy link

Have you confirmed any difference in ICE behavior from this?

Read more about the renomination draft here: https://datatracker.ietf.org/doc/html/draft-thatcher-ice-renomination-01

That draft expired in 2017. From my testing with https://jsfiddle.net/jib1/6h75teaj/ no browser negotiates (responds in kind in an answer to an offer containing) a=ice-options:trickle renomination, including Chrome or Canary.

We may need to white list the browsers that we know that supports this feature, or somehow fallback to original SDP if setLocalDescription gives back an error. My guess that if the browser does not supports this ice option, then probably it will give back an error when we try to setLocalDescription /setRemoteDescription the sdp.

I don't think so. Even if I munge both ends https://jsfiddle.net/jib1/6h75teaj/34/ none of the browsers fail sLD/sRD. This matches my understanding of SDP which lets end-points advertise and negotiate a shared subset of support, without failure. Hopefully there's no need for UA-sniff here.

If there's some feature enabled by this, we'd love to learn what it is so it can be standardized!

@nandito
Copy link
Contributor Author

nandito commented Mar 17, 2025

Thank you for your input! 🙏

Have you confirmed any difference in ICE behavior from this?

Read more about the renomination draft here: https://datatracker.ietf.org/doc/html/draft-thatcher-ice-renomination-01

That draft expired in 2017. From my testing with https://jsfiddle.net/jib1/6h75teaj/ no browser negotiates (responds in kind in an answer to an offer containing) a=ice-options:trickle renomination, including Chrome or Canary.

We did a few measurements by running the example scenario from the linked draft. In most tests, we experienced slightly faster reconnects when the renomination keyword was added to the SDP, but this improvement and ICE behavior change is not fully confirmed yet.

Starting Chrome with --enable-logging=stderr --v=2, we can see the renomination enabled or disabled in the logs; this indicates that the keyword is not completely ignored. We haven't spent too much time trying to understand what happens under the hood in the browser by examining the Chromium codebase, though.

We're investigating how to measure the impact of this flag.

Hopefully there's no need for UA-sniff here.

There's no need to add any UA-sniff here. I thought first Firefox ignores the SDP if it has this renomination keyword, but it turned out it was because a bug I added in an earlier version of this PR. 🙈 But there's no UA-sniffing since I fixed that.

@nandito nandito force-pushed the nandor/cob-1515-ice-renomination branch from c5832d4 to 4c8b80d Compare March 18, 2025 08:48
@nandito
Copy link
Contributor Author

nandito commented Mar 18, 2025

/canary

@github-actions
Copy link
Contributor

🚀 The canary releases have been published to npm.

You can test the releases by installing the newly published versions:

yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]
yarn add @whereby.com/[email protected]

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.

5 participants