Skip to content

Use Ice Candidates Pool #1018

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

jpsantosbh
Copy link
Collaborator

Description

The changes will enable the pre-gathering of ice candidates as soon as we instantiate the RTCPeerConnection.
To create some room for the pre-gathering the RTCPeerConnection instantiation was moved to the top of the RTCPeer.start() method. introducing one side effect.

Side Effect

In the very first use of an Application the RTCPeerConnection will be instantiated with no User Media permission, making all typ host candidates with mDNS addresses instead of IP addresses. Since we filter all mDNS candidates from the SDP before sending it to the server the SDP will have no typ host candidates.

a=candidate:441981974 1 udp 1677729536 189.71.169.171 57645 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999
a=candidate:3969930897 1 udp 33562880 104.131.13.246 38342 typ relay raddr 189.71.169.171 rport 57645 generation 0 network-cost 999
a=candidate:302678533 1 udp 16785152 104.131.13.246 28363 typ relay raddr 189.71.169.171 rport 64803 generation 0 network-cost 999
a=candidate:302678533 1 udp 16785152 104.131.13.246 28362 typ relay raddr 189.71.169.171 rport 64806 generation 0 network-cost 999

Tests show no impact on the connectivity or setup time for that very first call.

Call Setup with host candidates

2024-04-11T12:36:43.444Z - SEND: (Invite)
2024-04-11T12:36:43.986Z - RECV: (Conversation Event - Call Started)
2024-04-11T12:36:44.804Z - RECV:  (CALL CREATED)

Total 1360ms

Call Setup with no host candidates

2024-04-11T12:54:43.866Z - SEND: (Invite)
2024-04-11T12:54:44.449Z - RECV (Conversation Event - Call Started)
2024-04-11T12:54:45.172Z - RECV (CALL CREATED)

Total 1306ms

Next calls the SDP will have all the candidates

a=candidate:2669029645 1 udp 2122194688 192.168.3.52 62285 typ host generation 0 network-id 3
a=candidate:2652265259 1 udp 1685987072 189.71.169.171 62285 typ srflx raddr 192.168.3.52 rport 62285 generation 0 network-id 3
a=candidate:1047017511 1 udp 2122063616 192.168.3.75 51546 typ host generation 0 network-id 1 network-cost 10
a=candidate:1063799297 1 udp 1685856000 189.71.169.171 51546 typ srflx raddr 192.168.3.75 rport 51546 generation 0 network-id 1 network-cost 10
a=candidate:4234943797 1 udp 2122265344 fdf8:af05:cef:5100:c39:d3c9:957b:a1c 63754 typ host generation 0 network-id 4
a=candidate:4003022956 1 udp 2122134272 fdf8:af05:cef:5100:474:2f54:c6e0:c543 59553 typ host generation 0 network-id 2 network-cost 10
a=candidate:1639775641 1 tcp 1518214912 192.168.3.52 9 typ host tcptype active generation 0 network-id 3
a=candidate:3234000051 1 tcp 1518083840 192.168.3.75 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:46582177 1 tcp 1518285568 fdf8:af05:cef:5100:c39:d3c9:957b:a1c 9 typ host tcptype active generation 0 network-id 4
a=candidate:271817976 1 tcp 1518154496 fdf8:af05:cef:5100:474:2f54:c6e0:c543 9 typ host tcptype active generation 0 network-id 2 network-cost 10
a=candidate:1867389088 1 udp 41820415 104.131.13.246 47935 typ relay raddr 189.71.169.171 rport 62285 generation 0 network-id 3
a=candidate:1867389088 1 udp 41689343 104.131.13.246 47524 typ relay raddr 189.71.169.171 rport 51546 generation 0 network-id 1 network-cost 10

Type of change

  • Internal refactoring
  • Bug fix (bugfix - non-breaking)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Code snippets

In case of new feature or breaking changes, please include code snippets.

@jpsantosbh jpsantosbh requested a review from giavac April 11, 2024 13:46
Copy link

changeset-bot bot commented Apr 11, 2024

🦋 Changeset detected

Latest commit: 24f148f

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

This PR includes changesets to release 2 packages
Name Type
@signalwire/webrtc Patch
@signalwire/js 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

@@ -68,7 +68,7 @@ const DEFAULT_CALL_OPTIONS: ConnectionOptions = {
userVariables: {},
requestTimeout: 10 * 1000,
autoApplyMediaParams: true,
iceGatheringTimeout: 2 * 1000,
iceGatheringTimeout: 15,
Copy link
Member

Choose a reason for hiding this comment

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

ICE gathering timeout has been set to 15ms? Or did you mean to set it for 1.5 seconds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

15ms, this is for each candidate

Base automatically changed from dev to main April 26, 2024 14:22
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