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

Keep the negotiating state until the SDP is ready #558

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

giavac
Copy link
Contributor

@giavac giavac commented Dec 23, 2024

When answering a call, when setting the remote description the signaling state moves to have-remote-offer.
Peer's _negotiating is set to true, to prevent triggering new negotiations during this phase.

However, when setting the local description, while the ICE candidates haven't been gathered yet, the signaling state moves to stable.

A new onnegotiationneeded at that point would trigger a new negotiation, which is not desired, and a loop starts, continuing during the call itself.

This is invisible unless debug logging is activated, but has the side effect of causing some ICE candidates to be excluded from the SDP before it's transmitted. This per se doesn't cause the call to fail, which made the bug harder to track.

With the changes in this PR though, the "negotiating" state is kept in the Peer until the final SDP will be ready.

In my tests this proved to fix the issue with the infinite loop and the missing candidates.

Admittedly, I haven't tested the case of the Peer generating a call, which is a scenario that shares some of the change code, but I've only tested the case of the Peer receiving a call.

@giavac giavac assigned jpsantosbh and iAmmar7 and unassigned jpsantosbh and iAmmar7 Dec 23, 2024
@giavac giavac requested review from jpsantosbh and iAmmar7 December 23, 2024 16:54
@giavac giavac force-pushed the gv/missing_ice_candidates branch from 32998c4 to 029edc1 Compare December 23, 2024 17:40
jpsantosbh
jpsantosbh previously approved these changes Jan 7, 2025
iAmmar7
iAmmar7 previously approved these changes Jan 9, 2025
Copy link
Contributor

@iAmmar7 iAmmar7 left a comment

Choose a reason for hiding this comment

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

Looks okay to me, just minor suggestions. Feel free to defer that to later PRs.

packages/common/src/webrtc/Peer.ts Outdated Show resolved Hide resolved
packages/common/src/webrtc/Peer.ts Outdated Show resolved Hide resolved
packages/common/src/webrtc/Peer.ts Outdated Show resolved Hide resolved
packages/common/src/webrtc/BaseCall.ts Show resolved Hide resolved
@iAmmar7
Copy link
Contributor

iAmmar7 commented Jan 9, 2025

Admittedly, I haven't tested the case of the Peer generating a call, which is a scenario that shares some of the change code, but I've only tested the case of the Peer receiving a call.

Is it not so straightforward to generate a call from the Peer?

@giavac giavac dismissed stale reviews from iAmmar7 and jpsantosbh via 6f0ecb0 January 9, 2025 14:18
@giavac giavac requested review from iAmmar7 and jpsantosbh January 9, 2025 14:18
@giavac
Copy link
Contributor Author

giavac commented Jan 10, 2025

Admittedly, I haven't tested the case of the Peer generating a call, which is a scenario that shares some of the change code, but I've only tested the case of the Peer receiving a call.

Is it not so straightforward to generate a call from the Peer?

Yes, that was at the moment of raising the PR; I tested the call generation since that comment.

@giavac giavac merged commit 2877060 into main Jan 10, 2025
3 checks passed
@giavac giavac deleted the gv/missing_ice_candidates branch January 10, 2025 14:56
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.

3 participants