|
@@ -3,7 +3,6 @@ import transform from 'sdp-transform';
|
3
|
3
|
|
4
|
4
|
import * as MediaType from '../../service/RTC/MediaType';
|
5
|
5
|
import RTCEvents from '../../service/RTC/RTCEvents';
|
6
|
|
-import VideoType from '../../service/RTC/VideoType';
|
7
|
6
|
import browser from '../browser';
|
8
|
7
|
|
9
|
8
|
const logger = getLogger(__filename);
|
|
@@ -447,20 +446,18 @@ export class TPCUtils {
|
447
|
446
|
* @returns {void}
|
448
|
447
|
*/
|
449
|
448
|
updateEncodingsResolution(parameters) {
|
450
|
|
- const localVideoTrack = this.pc.getLocalVideoTrack();
|
451
|
|
-
|
452
|
|
- // Ignore desktop and non-simulcast tracks.
|
453
|
|
- if (!(parameters
|
454
|
|
- && parameters.encodings
|
455
|
|
- && Array.isArray(parameters.encodings)
|
456
|
|
- && this.pc.isSimulcastOn()
|
457
|
|
- && localVideoTrack
|
458
|
|
- && localVideoTrack.videoType !== VideoType.DESKTOP)) {
|
|
449
|
+ if (!(browser.isSafari() && parameters.encodings && Array.isArray(parameters.encodings))) {
|
459
|
450
|
return;
|
460
|
451
|
}
|
461
|
|
-
|
462
|
|
- parameters.encodings.forEach((encoding, idx) => {
|
463
|
|
- encoding.scaleResolutionDownBy = this.localStreamEncodingsConfig[idx].scaleResolutionDownBy;
|
464
|
|
- });
|
|
452
|
+ const allEqualEncodings
|
|
453
|
+ = encodings => encodings.every(encoding => typeof encoding.scaleResolutionDownBy !== 'undefined'
|
|
454
|
+ && encoding.scaleResolutionDownBy === encodings[0].scaleResolutionDownBy);
|
|
455
|
+
|
|
456
|
+ // Implement the workaround only when all the encodings report the same resolution.
|
|
457
|
+ if (allEqualEncodings(parameters.encodings)) {
|
|
458
|
+ parameters.encodings.forEach((encoding, idx) => {
|
|
459
|
+ encoding.scaleResolutionDownBy = this.localStreamEncodingsConfig[idx].scaleResolutionDownBy;
|
|
460
|
+ });
|
|
461
|
+ }
|
465
|
462
|
}
|
466
|
463
|
}
|