Browse Source

fix(TPC): Use a default maxHeight for configuring encodings.

This is needed when p2p conn establishes before jvb and no sender constraints have been received before media on jvb conn is suspended.
release-8443
Jaya Allamsetty 1 year ago
parent
commit
b0356800ca
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      modules/RTC/TraceablePeerConnection.js

+ 9
- 3
modules/RTC/TraceablePeerConnection.js View File

@@ -2085,7 +2085,8 @@ TraceablePeerConnection.prototype.configureAudioSenderEncodings = function(local
2085 2085
 };
2086 2086
 
2087 2087
 /**
2088
- * Configures the stream encodings depending on the video type and the bitrates configured.
2088
+ * Configures the stream encodings depending on the video type, scalability mode and the bitrate settings for the codec
2089
+ * that is currently selected.
2089 2090
  *
2090 2091
  * @param {JitsiLocalTrack} - The local track for which the sender encodings have to configured.
2091 2092
  * @returns {Promise} promise that will be resolved when the operation is successful and rejected otherwise.
@@ -2099,7 +2100,9 @@ TraceablePeerConnection.prototype.configureVideoSenderEncodings = function(local
2099 2100
     const promises = [];
2100 2101
 
2101 2102
     for (const track of this.getLocalVideoTracks()) {
2102
-        promises.push(this.setSenderVideoConstraints(this._senderMaxHeights.get(track.getSourceName()), track));
2103
+        const maxHeight = this._senderMaxHeights.get(track.getSourceName()) ?? VIDEO_QUALITY_LEVELS[0].height;
2104
+
2105
+        promises.push(this.setSenderVideoConstraints(maxHeight, track));
2103 2106
     }
2104 2107
 
2105 2108
     return Promise.allSettled(promises);
@@ -2271,6 +2274,7 @@ TraceablePeerConnection.prototype._updateVideoSenderEncodings = function(frameHe
2271 2274
     const activeState = this.tpcUtils.calculateEncodingsActiveState(localVideoTrack, codec, frameHeight);
2272 2275
     const scaleFactors = this.tpcUtils.calculateEncodingsScaleFactor(localVideoTrack, codec, frameHeight);
2273 2276
     const scalabilityModes = this.tpcUtils.calculateEncodingsScalabilityMode(localVideoTrack, codec, frameHeight);
2277
+    const sourceName = localVideoTrack.getSourceName();
2274 2278
     let needsUpdate = false;
2275 2279
 
2276 2280
     for (const idx in parameters.encodings) {
@@ -2320,13 +2324,15 @@ TraceablePeerConnection.prototype._updateVideoSenderEncodings = function(frameHe
2320 2324
     }
2321 2325
 
2322 2326
     if (!needsUpdate) {
2327
+        this._senderMaxHeights.set(sourceName, frameHeight);
2328
+
2323 2329
         return Promise.resolve();
2324 2330
     }
2325 2331
 
2326 2332
     logger.info(`${this} setting max height=${frameHeight},encodings=${JSON.stringify(parameters.encodings)}`);
2327 2333
 
2328 2334
     return videoSender.setParameters(parameters).then(() => {
2329
-        this._senderMaxHeights.set(localVideoTrack.getSourceName(), frameHeight);
2335
+        this._senderMaxHeights.set(sourceName, frameHeight);
2330 2336
         localVideoTrack.maxEnabledResolution = frameHeight;
2331 2337
         this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED, localVideoTrack);
2332 2338
     });

Loading…
Cancel
Save