Bug 1435013: Sync transceivers before creating offers/answers. r?jib
MozReview-Commit-ID: EORXVc8Hnky
--- 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");