Selaa lähdekoodia

fix(video-quality): make sure the LD stream is enabled even when requested resolution is lower

This should fix the case when camera is started with 1080p and LD simulcast stream's resolution is 270p but the requested resolution is 180p.
master
Jaya Allamsetty 5 vuotta sitten
vanhempi
commit
79a88d6434
1 muutettua tiedostoa jossa 14 lisäystä ja 6 poistoa
  1. 14
    6
      modules/RTC/TraceablePeerConnection.js

+ 14
- 6
modules/RTC/TraceablePeerConnection.js Näytä tiedosto

@@ -2267,12 +2267,20 @@ TraceablePeerConnection.prototype.setSenderVideoConstraint = function(frameHeigh
2267 2267
     }
2268 2268
 
2269 2269
     if (this.isSimulcastOn()) {
2270
-        // Determine the encodings that need to stay enabled based on the
2271
-        // new frameHeight provided.
2272
-        const encodingsEnabledState
2273
-            = this.tpcUtils.getLocalStreamHeightConstraints(localVideoTrack.track)
2274
-                .map(height => height <= newHeight);
2275
-
2270
+        // Determine the encodings that need to stay enabled based on the new frameHeight provided.
2271
+        const encodingsEnabledState = this.tpcUtils.getLocalStreamHeightConstraints(localVideoTrack.track)
2272
+            .map(height => height <= newHeight);
2273
+
2274
+        // Always keep the LD stream enabled, specifically when the LD stream's resolution is higher than of the
2275
+        // requested resolution. This can happen when camera is captured at resolutions higher than 720p but the
2276
+        // requested resolution is 180. Since getParameters doesn't give us information about the resolutions
2277
+        // of the simulcast encodings, we have to rely on our initial config for the simulcast streams.
2278
+        const ldStreamIndex = this.tpcUtils.localStreamEncodingsConfig
2279
+            .findIndex(layer => layer.scaleResolutionDownBy === 4.0);
2280
+
2281
+        if (newHeight > 0 && ldStreamIndex !== -1) {
2282
+            encodingsEnabledState[ldStreamIndex] = true;
2283
+        }
2276 2284
         for (const encoding in parameters.encodings) {
2277 2285
             if (parameters.encodings.hasOwnProperty(encoding)) {
2278 2286
                 parameters.encodings[encoding].active = encodingsEnabledState[encoding];

Loading…
Peruuta
Tallenna