|
@@ -2111,8 +2111,7 @@ TraceablePeerConnection.prototype.createDataChannel = function(label, opts) {
|
2111
|
2111
|
* the local description.
|
2112
|
2112
|
* @private
|
2113
|
2113
|
*/
|
2114
|
|
-TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(
|
2115
|
|
- localSdp) {
|
|
2114
|
+TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(localSdp) {
|
2116
|
2115
|
let sdpStr = localSdp.sdp;
|
2117
|
2116
|
|
2118
|
2117
|
const videoStartIndex = sdpStr.indexOf('m=video');
|
|
@@ -2300,47 +2299,39 @@ TraceablePeerConnection.prototype.configureSenderVideoEncodings = function() {
|
2300
|
2299
|
};
|
2301
|
2300
|
|
2302
|
2301
|
TraceablePeerConnection.prototype.setLocalDescription = function(description) {
|
2303
|
|
- let localSdp = description;
|
|
2302
|
+ let localDescription = description;
|
2304
|
2303
|
|
2305
|
|
- this.trace('setLocalDescription::preTransform', dumpSDP(localSdp));
|
|
2304
|
+ this.trace('setLocalDescription::preTransform', dumpSDP(localDescription));
|
2306
|
2305
|
|
2307
|
2306
|
// Munge stereo flag and opusMaxAverageBitrate based on config.js
|
2308
|
|
- localSdp = this._mungeOpus(localSdp);
|
|
2307
|
+ localDescription = this._mungeOpus(localDescription);
|
2309
|
2308
|
|
2310
|
2309
|
if (!this._usesUnifiedPlan) {
|
2311
|
|
- localSdp = this._adjustLocalMediaDirection(localSdp);
|
2312
|
|
- localSdp = this._ensureSimulcastGroupIsLast(localSdp);
|
2313
|
|
- } else if (!this.isP2P) {
|
2314
|
|
-
|
2315
|
|
- // if we're using unified plan, transform to it first.
|
2316
|
|
- localSdp = this.interop.toUnifiedPlan(localSdp);
|
2317
|
|
- this.trace(
|
2318
|
|
- 'setLocalDescription::postTransform (Unified Plan)',
|
2319
|
|
- dumpSDP(localSdp));
|
|
2310
|
+ localDescription = this._adjustLocalMediaDirection(localDescription);
|
|
2311
|
+ localDescription = this._ensureSimulcastGroupIsLast(localDescription);
|
2320
|
2312
|
}
|
2321
|
2313
|
|
2322
|
2314
|
// Munge the order of the codecs based on the preferences set through config.js if we are using SDP munging.
|
2323
|
2315
|
if (!this._usesTransceiverCodecPreferences) {
|
2324
|
|
- localSdp = this._mungeCodecOrder(localSdp);
|
|
2316
|
+ localDescription = this._mungeCodecOrder(localDescription);
|
2325
|
2317
|
}
|
2326
|
2318
|
|
|
2319
|
+ this.trace('setLocalDescription::postTransform', dumpSDP(localDescription));
|
|
2320
|
+
|
2327
|
2321
|
return new Promise((resolve, reject) => {
|
2328
|
|
- this.peerconnection.setLocalDescription(localSdp)
|
|
2322
|
+ this.peerconnection.setLocalDescription(localDescription)
|
2329
|
2323
|
.then(() => {
|
2330
|
2324
|
this.trace('setLocalDescriptionOnSuccess');
|
2331
|
|
- const localUfrag = SDPUtil.getUfrag(localSdp.sdp);
|
|
2325
|
+ const localUfrag = SDPUtil.getUfrag(localDescription.sdp);
|
2332
|
2326
|
|
2333
|
2327
|
if (localUfrag !== this.localUfrag) {
|
2334
|
2328
|
this.localUfrag = localUfrag;
|
2335
|
|
- this.eventEmitter.emit(
|
2336
|
|
- RTCEvents.LOCAL_UFRAG_CHANGED, this, localUfrag);
|
|
2329
|
+ this.eventEmitter.emit(RTCEvents.LOCAL_UFRAG_CHANGED, this, localUfrag);
|
2337
|
2330
|
}
|
2338
|
2331
|
resolve();
|
2339
|
2332
|
}, err => {
|
2340
|
2333
|
this.trace('setLocalDescriptionOnFailure', err);
|
2341
|
|
- this.eventEmitter.emit(
|
2342
|
|
- RTCEvents.SET_LOCAL_DESCRIPTION_FAILED,
|
2343
|
|
- err, this);
|
|
2334
|
+ this.eventEmitter.emit(RTCEvents.SET_LOCAL_DESCRIPTION_FAILED, err, this);
|
2344
|
2335
|
reject(err);
|
2345
|
2336
|
});
|
2346
|
2337
|
});
|