PSA: Perfect Negotiation support in M87

885 views
Skip to first unread message

Henrik Boström

unread,
Sep 9, 2020, 5:28:15 AM9/9/20
to discuss-webrtc
Perfect Negotiation is now supported in Chrome M87!

This is a pattern of exchanging offer and answer SDP that an application can make use of to abstract away when and how to do signaling. By attaching code that exercises this pattern when "onnegotiationneeded" is fired, the negotiation code can be written once in isolation from the rest of the application code, and whenever the application then modifies the RTCPeerConnection in such a way that renegotiation is needed, the negotiation code will be exercised automatically, and the changes will be made visible at both the local and remote endpoints.

Perfect Negotiation supports both endpoints sending offers. The pattern intelligently handles the situation of "glare" (both peers making an offer at the same time, causing a collision) by having one peer be "polite" and the other peer be "impolite". In the event of an offer collision, the polite peer rolls back its offer in order to process the impolite peer's incoming offer. Once back to the stable signaling state, the polite peer's "onnegotiationneeded" fires again and a follow-up O/A is completed.

("Start" creates two local streams, "Swap" alternates which one of them is sent.)

There are no new APIs added for Perfect Negotiation; what is fixed in M87 are bugs and races in "onnegotiationneeeded" and other events. (If you run the demo in M86, clicking "Start" followed by "Swap on both (glare)" can result in negotiation never completing.)

For more information about Perfect Negotiation, see...
Perfect Negotiation is only supported in Unified Plan, not Plan B.

Tsahi Levent-Levi

unread,
Sep 9, 2020, 6:51:23 AM9/9/20
to discuss...@googlegroups.com
Henrik,

Thanks for this!

I think it would make Perfect Sense to place the Perfect Negotiation demo as a Perfect Sample in the github repo instead of an unnamed jsfiddle that no one will know how to get back to next week (pun intended)

--
Regards,
Tsahi Levent-Levi
Analyst & Consultant

Want to get more of your WebRTC sessions effectively connected? Enroll to my free video course: http://bit.ly/32Y3qZK

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/abc6f19e-ca95-43ad-8ee4-2cca11d2c1d4n%40googlegroups.com.


--
Regards,
Tsahi Levent-Levi
Analyst & Consultant

Want to get more of your WebRTC sessions effectively connected? Enroll to my free video course: http://bit.ly/32Y3qZK

Henrik Boström

unread,
Sep 9, 2020, 7:38:21 AM9/9/20
to discuss-webrtc
I agree and I filed https://github.com/webrtc/samples/issues/1352 as a follow-up, but me personally I'm sadly short on time at the moment, so I don't know the ETA on the Perfect Sample.

Henrik Boström

unread,
Nov 27, 2020, 4:54:01 AM11/27/20
to discuss-webrtc
We now have a working samples page thanks to external contributions from SCG82 turning the jsfiddle into a samples page:

Reminder that version M87 or later is needed for it to always work. (In M86 it usually works butt sometimes a race condition makes it stop negotiating automatically and then the video stops.)

HANVI Babeni

unread,
Dec 1, 2020, 3:09:51 AM12/1/20
to discuss-webrtc
  i need video call webrtc code in html5  css3 AND javascript ON opera because i use opera navigator  
Reply all
Reply to author
Forward
0 new messages