Skip to content

examples: webrtc: js: Fix for offer send onNegotiationNeeded

Akash Ashok requested to merge thehellmaker/gstreamer:webrtc-js-flow-fix into main

Client was sending offer onNegotiationNeeded and onNegotiationNeeded was called when datachannel was created or when localstream is added to RTCPeerConnection.

Consider the flow where

  1. Rust App sends offer to JS App.
  2. JS App recieves the offer sets remote description and sends answer
  3. But setRemoteDescription calls onNegotitationNeeded and then sends an offer in parallell withe the answer
  4. Rust App recieves the offer and errors out with processing since offer was sent by the rust app and answer is recieved but offer came again

The state management had a lot more issues with respect to 2 JS Apps communicating as well for OFFER_REQUEST flows etc. This commit refactors the entire js client to ensure it works reliably with Both 2 JS Apps as well as a Rust and Js App.

Merge request reports