Skip to content

Commit dd8c71f

Browse files
committed
"Fix encoding logic to handle reversed arrays "
1 parent d07add3 commit dd8c71f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/RTC/TPCUtils.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,14 @@ export class TPCUtils {
383383
// requested resolution. This can happen when camera is captured at high resolutions like 4k
384384
// but the requested resolution is 180. Since getParameters doesn't give us information about
385385
// the resolutions of the simulcast encodings, we have to rely on our initial config for the
386-
// simulcast streams.
387-
|| videoStreamEncodings[idx]?.scaleResolutionDownBy === SIM_LAYERS[0].scaleFactor;
386+
// simulcast streams. We check for the lowest quality scale factor (4.0) regardless of array
387+
// position since the encoding order may be reversed for Firefox or low-res Chromium VP8.
388+
|| videoStreamEncodings[idx]?.scaleResolutionDownBy === 4.0;
388389
} else {
389390
// For screenshare, keep the HD layer enabled always and the lower layers only for high fps
390-
// screensharing.
391-
activeState = videoStreamEncodings[idx].scaleResolutionDownBy === SIM_LAYERS[2].scaleFactor
391+
// screensharing. We check for the highest quality scale factor (1.0) regardless of array position
392+
// since the encoding order may be reversed for Firefox.
393+
activeState = videoStreamEncodings[idx].scaleResolutionDownBy === 1.0
392394
|| !this._isScreenshareBitrateCapped(localVideoTrack);
393395
}
394396
}

0 commit comments

Comments
 (0)