Browse Source

ref(TPC) Remove an unnecessary toUnified sdp conversion.

sLD is called immediately after createOffer/createAnswer, therefore the desc provided by createOffer/createAnswer can be directly passed to sLD without the need for converting it to unified plan format. This also fixes a warning seen on the browser console that says 'The description does not look like plan-b'.
dev1
Jaya Allamsetty 3 years ago
parent
commit
9393d03992
1 changed files with 13 additions and 22 deletions
  1. 13
    22
      modules/RTC/TraceablePeerConnection.js

+ 13
- 22
modules/RTC/TraceablePeerConnection.js View File

2111
  * the local description.
2111
  * the local description.
2112
  * @private
2112
  * @private
2113
  */
2113
  */
2114
-TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(
2115
-        localSdp) {
2114
+TraceablePeerConnection.prototype._ensureSimulcastGroupIsLast = function(localSdp) {
2116
     let sdpStr = localSdp.sdp;
2115
     let sdpStr = localSdp.sdp;
2117
 
2116
 
2118
     const videoStartIndex = sdpStr.indexOf('m=video');
2117
     const videoStartIndex = sdpStr.indexOf('m=video');
2300
 };
2299
 };
2301
 
2300
 
2302
 TraceablePeerConnection.prototype.setLocalDescription = function(description) {
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
     // Munge stereo flag and opusMaxAverageBitrate based on config.js
2306
     // Munge stereo flag and opusMaxAverageBitrate based on config.js
2308
-    localSdp = this._mungeOpus(localSdp);
2307
+    localDescription = this._mungeOpus(localDescription);
2309
 
2308
 
2310
     if (!this._usesUnifiedPlan) {
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
     // Munge the order of the codecs based on the preferences set through config.js if we are using SDP munging.
2314
     // Munge the order of the codecs based on the preferences set through config.js if we are using SDP munging.
2323
     if (!this._usesTransceiverCodecPreferences) {
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
     return new Promise((resolve, reject) => {
2321
     return new Promise((resolve, reject) => {
2328
-        this.peerconnection.setLocalDescription(localSdp)
2322
+        this.peerconnection.setLocalDescription(localDescription)
2329
             .then(() => {
2323
             .then(() => {
2330
                 this.trace('setLocalDescriptionOnSuccess');
2324
                 this.trace('setLocalDescriptionOnSuccess');
2331
-                const localUfrag = SDPUtil.getUfrag(localSdp.sdp);
2325
+                const localUfrag = SDPUtil.getUfrag(localDescription.sdp);
2332
 
2326
 
2333
                 if (localUfrag !== this.localUfrag) {
2327
                 if (localUfrag !== this.localUfrag) {
2334
                     this.localUfrag = localUfrag;
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
                 resolve();
2331
                 resolve();
2339
             }, err => {
2332
             }, err => {
2340
                 this.trace('setLocalDescriptionOnFailure', err);
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
                 reject(err);
2335
                 reject(err);
2345
             });
2336
             });
2346
     });
2337
     });

Loading…
Cancel
Save