fix(webrtc): Fix Firefox simulcast race condition and respect HPB bandwidth limits#17776
fix(webrtc): Fix Firefox simulcast race condition and respect HPB bandwidth limits#17776tareko wants to merge 1 commit into
Conversation
β¦dwidth limits - Chain sender.setParameters() before createOffer() in Firefox to avoid a race where the offer SDP is generated before simulcast encodings are applied. Previously the promise was ignored, causing simulcast to fail silently on low-bandwidth links and fall back to a single high-bitrate stream that congested the connection. - Add _getMaxBitrates() helper that derives simulcast tiers from the signaling server's maxstreambitrate instead of hardcoded values. The server already sent this limit in the room join response but the client never used it, so publishers always tried to push 1.3 Mbps even when the uplink or server policy was much lower. - Parse data.room.bandwidth.maxstreambitrate in joinResponseReceived and expose it on the signaling connection so Peer objects can read it. - Guard s.track before accessing s.track.kind in getSenders() find, matching the existing upstream fix for disabled tracks in Firefox. Fixes #17774 Signed-off-by: Tarek Loubani <tarek@tarek.org>
|
Past 2 of your fixes I already did in #17670 π |
That's so great. I tried to look and see if this was anywhere, but couldn't quite find it. Does that mean this PR should close? Or was there something in this PR you thought could be useful? |
|
Well you seem to address more, but since you vibed it and I have not enough knowledge about the sdp patching, I leave this to the experts. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
When using Firefox with the High Performance Backend (HPB / MCU) and simulcast enabled, the publisher side initializes simulcast encodings via
sender.setParameters(). However, the returnedPromiseis not awaited beforecreateOffer()is called. This creates a race condition where the offer SDP may be generated before the simulcast parameters are actually applied to the sender.This fixes issue #17774 - more details in that issue. OpenCode with Kimi 2.6 and Qwen 3.6 35B3A were used to debug and repair.