Re: [webrtc-pc] addIceCandidate may not need to throw an error when no remoteDescription (#2519)

I haven't seen this much in the last three years but by coincidence this came up on [stackoverflow this week](https://stackoverflow.com/questions/76130700/javascript-callback-would-wait-async-function-to-complete) and with an example that explains why this can happen sometimes.
The flow that breaks is shown by this fiddle:
https://jsfiddle.net/fippo/b4hLpc2d/2/

The root cause here is the messageHandler is not an async function and gets called while there is still a call in progress. That is a problem of the signaling and not a WebRTC problem.
The second problem is calling getUserMedia before calling setRemoteDescription. Changing this to call setRemoteDescription before getUserMedia makes things work just fine as show by this variant of the fiddle:
https://jsfiddle.net/fippo/b4hLpc2d/3/

If you want to cache candidates before SRD I wish you good luck with specifying all the edge cases...

-- 
GitHub Notification of comment by fippo
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2519#issuecomment-1527745311 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 28 April 2023 15:36:29 UTC