W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > March 2020

Re: [webrtc-pc] When is negotiation complete? (#2495)

From: henbos via GitHub <sysbot+gh@w3.org>
Date: Mon, 30 Mar 2020 13:27:15 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-605998218-1585574834-sysbot+gh@w3.org>
**If this is just for testing...**

Wouldn't the following be able to tell if negotiation was needed in most cases? There might be special cases like when pc closes, if data channels are used or if setCodecPreference or setStreams has happened, but those would probably be separate tests anyway:

function isNegotiationNeeded() {
  for (transceiver of pc.getTransceivers()) {
    if (transceiver.currentDirection != transceiver.direction)
      return true;
  return false;

And at strategic points in WPTs, probably when returning to stable, you could...
const wasNegotiationNeeded = isNegotiationNeeded();
let didFireNegotiationNeeded = false;
pc.onnegotiationneeded = () => { didFireNegotiationNeeded = true; }
await new Promise(r => setTimeout(r, 0));
assert_equals(wasNegotiationNeeded, didFireNegotiationNeeded);

**With regards to Proposal B (Expose a negotiationneeded boolean attribute) **

> Complication: once set, we MUST fire negotiationneeded event, to meet JS expectations.

Why is this complicated? Why is having to fire the event a problem? Because of "maybe fire" logic...?

GitHub Notification of comment by henbos
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2495#issuecomment-605998218 using your GitHub account
Received on Monday, 30 March 2020 13:27:17 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:50 UTC