Browse Source

fix(screenshare): Disable SS simulcast based on fps requested.

Disable simulcast for low fps screenshare and enable it for high fps screenshare. testing.capScreenshareBitrate config.js setting has now been deprecated.
dev1
Jaya Allamsetty 4 years ago
parent
commit
93628ed1b5
2 changed files with 10 additions and 15 deletions
  1. 1
    1
      modules/RTC/RTCUtils.js
  2. 9
    14
      modules/xmpp/JingleSessionPC.js

+ 1
- 1
modules/RTC/RTCUtils.js View File

@@ -70,7 +70,7 @@ const DEFAULT_CONSTRAINTS = {
70 70
 /**
71 71
  * The default frame rate for Screen Sharing.
72 72
  */
73
-const SS_DEFAULT_FRAME_RATE = 5;
73
+export const SS_DEFAULT_FRAME_RATE = 5;
74 74
 
75 75
 // Currently audio output device change is supported only in Chrome and
76 76
 // default output always has 'default' device ID

+ 9
- 14
modules/xmpp/JingleSessionPC.js View File

@@ -9,6 +9,7 @@ import {
9 9
     ICE_STATE_CHANGED
10 10
 } from '../../service/statistics/AnalyticsEvents';
11 11
 import XMPPEvents from '../../service/xmpp/XMPPEvents';
12
+import { SS_DEFAULT_FRAME_RATE } from '../RTC/RTCUtils';
12 13
 import Statistics from '../statistics/statistics';
13 14
 import AsyncQueue from '../util/AsyncQueue';
14 15
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
@@ -352,20 +353,14 @@ export default class JingleSessionPC extends JingleSession {
352 353
                     || (options.preferH264 && !options.disableH264)
353 354
                     || (options.videoQuality && options.videoQuality.preferredCodec === CodecMimeType.H264);
354 355
 
355
-            // disable simulcast for screenshare and set the max bitrate to
356
-            // 500Kbps if the testing flag is present in config.js.
357
-            if (options.testing
358
-                && options.testing.capScreenshareBitrate
359
-                && typeof options.testing.capScreenshareBitrate === 'number') {
360
-                pcOptions.capScreenshareBitrate
361
-                    = Math.random()
362
-                    < options.testing.capScreenshareBitrate;
363
-
364
-                // add the capScreenshareBitrate to the permanent properties so
365
-                // that it's included with every event that we send to the
366
-                // analytics backend.
367
-                Statistics.analytics.addPermanentProperties({ capScreenshareBitrate: pcOptions.capScreenshareBitrate });
368
-            }
356
+            // Disable simulcast for low fps screenshare and enable it for high fps screenshare.
357
+            // testing.capScreenshareBitrate config.js setting has now been deprecated.
358
+            pcOptions.capScreenshareBitrate = !(typeof options.desktopSharingFrameRate?.max === 'number'
359
+                && options.desktopSharingFrameRate?.max > SS_DEFAULT_FRAME_RATE);
360
+
361
+            // add the capScreenshareBitrate to the permanent properties so that it's included with every event that we
362
+            // send to the analytics backend.
363
+            Statistics.analytics.addPermanentProperties({ capScreenshareBitrate: pcOptions.capScreenshareBitrate });
369 364
         }
370 365
 
371 366
         if (options.startSilent) {

Loading…
Cancel
Save