Skip to content
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

WebRTC Peer Connection generated ICE candidates do not use SDP MID of the original offer #1259

Open
jp-fournier-dev opened this issue Dec 17, 2024 · 2 comments

Comments

@jp-fournier-dev
Copy link
Contributor

When working with an iOS we've encountered a bug related to how the ICE candidates are generated : it seems we don't adjust the sdpMid value to match the offer received from the mobile device.

For example, iOS gives us SDP with the following mid :

a=group:BUNDLE audio video
...
a=mid:audio
...
a=mid:video

while Android is giving us the following :

a=group:BUNDLE 0 1
...
a=mid:0
...
a=mid:1

This works well without trickle, since when the SDP answer is generated by the RTC Peer Connection, the mid are conserved from the offer. Meanwhile, when ICE candidates are generated and sent as we go, they do not get adjusted with the according mid. This causes iOS to ignore the candidates and for the connection to only be tested using the candidates that are in the SDP.

Using workaround I can make this work and was curious what is the stance on this ? Should it be the responsability of another element to fix the candidates ? There's a chicken and egg situation here, where to generate candidates accurately, you need to have the offer in hand to begin with and set the mid according to it. Given that the RTCPeerConnection starts gathering immediately, is the better way to go to restartIce once the offer is applied and only get the candidates from then?

@sipsorcery
Copy link
Member

I think restarting the ICE gaterhing would be inefficient especially if there are TURN servers involved.

Seems like the best way would be to update the mid's on the already gathered ICE candidates or some kind of mapping from the initial mid to the new ones supplied in the offer.

@jp-fournier-dev
Copy link
Contributor Author

I'll probably go from there indeed.

The only way I see this working otherwise is by permitting constructing the RTCPeerConnection with an offer in hand already so that the generated ICE candidates can be modified by the session before the event is raised, but that would require reworking the initialization phase of the connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants