Bug 1435013: Sync transceivers before creating offers/answers. r=jib a=lizzard
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 01 Feb 2018 12:07:02 -0600
changeset 452361 3c16503565e67e1a4046bf19016f7b4b15515532
parent 452360 70cc9d6d659f726d328bfd6b529b28adccd62b5e
child 452362 10d1af7903cb7f348453e5cca0a7901e9f56faa5
push id8695
push userebalazs@mozilla.com
push dateTue, 13 Feb 2018 13:20:58 +0000
treeherdermozilla-beta@3c16503565e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, lizzard
bugs1435013
milestone59.0
Bug 1435013: Sync transceivers before creating offers/answers. r=jib a=lizzard MozReview-Commit-ID: EORXVc8Hnky
dom/media/PeerConnection.js
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -844,16 +844,17 @@ class RTCPeerConnection {
         } else if (transceiver.direction == "recvonly") {
           transceiver.setDirectionInternal("inactive");
         }
       });
   }
 
   async _createOffer(options) {
     this._checkClosed();
+    this._syncTransceivers();
     let origin = Cu.getWebIDLCallerPrincipal().origin;
     return this._chain(async () => {
       let haveAssertion;
       if (this._localIdp.enabled) {
         haveAssertion = this._getIdentityAssertion(origin);
       }
       await this._getPermission();
       await this._certificateReady;
@@ -875,16 +876,17 @@ class RTCPeerConnection {
     if (typeof optionsOrOnSucc == "function") {
       return this._legacy(optionsOrOnSucc, onErr, () => this._createAnswer({}));
     }
     return this._async(() => this._createAnswer(optionsOrOnSucc));
   }
 
   async _createAnswer(options) {
     this._checkClosed();
+    this._syncTransceivers();
     let origin = Cu.getWebIDLCallerPrincipal().origin;
     return this._chain(async () => {
       // We give up line-numbers in errors by doing this here, but do all
       // state-checks inside the chain, to support the legacy feature that
       // callers don't have to wait for setRemoteDescription to finish.
       if (!this.remoteDescription) {
         throw new this._win.DOMException("setRemoteDescription not called",
                                          "InvalidStateError");