Browse Source

feat(RTC) drop no longer supported PC media constraints

They have been deprecated and their valued can no longer be changed from
the default after M103.

Ref: https://groups.google.com/u/0/g/discuss-webrtc/c/2l7jWgreYpw?pli=1
dev1
Saúl Ibarra Corretgé 3 years ago
parent
commit
59665767bf
3 changed files with 2 additions and 58 deletions
  1. 0
    8
      modules/RTC/RTC.js
  2. 1
    30
      modules/RTC/RTCUtils.js
  3. 1
    20
      types/auto/modules/RTC/RTCUtils.d.ts

+ 0
- 8
modules/RTC/RTC.js View File

6
 import RTCEvents from '../../service/RTC/RTCEvents';
6
 import RTCEvents from '../../service/RTC/RTCEvents';
7
 import browser from '../browser';
7
 import browser from '../browser';
8
 import FeatureFlags from '../flags/FeatureFlags';
8
 import FeatureFlags from '../flags/FeatureFlags';
9
-import Statistics from '../statistics/statistics';
10
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
9
 import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
11
 import Listenable from '../util/Listenable';
10
 import Listenable from '../util/Listenable';
12
 import { safeCounterIncrement } from '../util/MathUtil';
11
 import { safeCounterIncrement } from '../util/MathUtil';
505
     createPeerConnection(signaling, pcConfig, isP2P, options) {
504
     createPeerConnection(signaling, pcConfig, isP2P, options) {
506
         const pcConstraints = JSON.parse(JSON.stringify(RTCUtils.pcConstraints));
505
         const pcConstraints = JSON.parse(JSON.stringify(RTCUtils.pcConstraints));
507
 
506
 
508
-        if (typeof options.abtestSuspendVideo !== 'undefined') {
509
-            RTCUtils.setSuspendVideo(pcConstraints, options.abtestSuspendVideo);
510
-
511
-            Statistics.analytics.addPermanentProperties(
512
-                { abtestSuspendVideo: options.abtestSuspendVideo });
513
-        }
514
-
515
         if (options.enableInsertableStreams) {
507
         if (options.enableInsertableStreams) {
516
             logger.debug('E2EE - setting insertable streams constraints');
508
             logger.debug('E2EE - setting insertable streams constraints');
517
             pcConfig.encodedInsertableStreams = true;
509
             pcConfig.encodedInsertableStreams = true;

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

365
             this.getTrackID = ({ id }) => id;
365
             this.getTrackID = ({ id }) => id;
366
         }
366
         }
367
 
367
 
368
-        this.pcConstraints = browser.isChromiumBased() || browser.isReactNative()
369
-            ? { optional: [
370
-                { googScreencastMinBitrate: 100 },
371
-                { googCpuOveruseDetection: true }
372
-            ] }
373
-            : {};
368
+        this.pcConstraints = {};
374
 
369
 
375
         screenObtainer.init(options);
370
         screenObtainer.init(options);
376
 
371
 
879
 
874
 
880
         return { deviceList };
875
         return { deviceList };
881
     }
876
     }
882
-
883
-    /**
884
-     * Configures the given PeerConnection constraints to either enable or
885
-     * disable (according to the value of the 'enable' parameter) the
886
-     * 'googSuspendBelowMinBitrate' option.
887
-     * @param constraints the constraints on which to operate.
888
-     * @param enable {boolean} whether to enable or disable the suspend video
889
-     * option.
890
-     */
891
-    setSuspendVideo(constraints, enable) {
892
-        if (!constraints.optional) {
893
-            constraints.optional = [];
894
-        }
895
-
896
-        // Get rid of all "googSuspendBelowMinBitrate" constraints (we assume
897
-        // that the elements of constraints.optional contain a single property).
898
-        constraints.optional
899
-            = constraints.optional.filter(
900
-                c => !c.hasOwnProperty('googSuspendBelowMinBitrate'));
901
-
902
-        if (enable) {
903
-            constraints.optional.push({ googSuspendBelowMinBitrate: 'true' });
904
-        }
905
-    }
906
 }
877
 }
907
 
878
 
908
 const rtcUtils = new RTCUtils();
879
 const rtcUtils = new RTCUtils();

+ 1
- 20
types/auto/modules/RTC/RTCUtils.d.ts View File

30
     getTrackID: ({ id }: {
30
     getTrackID: ({ id }: {
31
         id: any;
31
         id: any;
32
     }) => any;
32
     }) => any;
33
-    pcConstraints: {
34
-        optional: ({
35
-            googScreencastMinBitrate: number;
36
-            googCpuOveruseDetection?: undefined;
37
-        } | {
38
-            googCpuOveruseDetection: boolean;
39
-            googScreencastMinBitrate?: undefined;
40
-        })[];
41
-    } | {
42
-        optional?: undefined;
43
-    };
33
+    pcConstraints: {};
44
     /**
34
     /**
45
      *
35
      *
46
      * @param {Function} callback
36
      * @param {Function} callback
168
      * @returns {MediaDeviceInfo} device.
158
      * @returns {MediaDeviceInfo} device.
169
      */
159
      */
170
     getEventDataForActiveDevice(device: any): MediaDeviceInfo;
160
     getEventDataForActiveDevice(device: any): MediaDeviceInfo;
171
-    /**
172
-     * Configures the given PeerConnection constraints to either enable or
173
-     * disable (according to the value of the 'enable' parameter) the
174
-     * 'googSuspendBelowMinBitrate' option.
175
-     * @param constraints the constraints on which to operate.
176
-     * @param enable {boolean} whether to enable or disable the suspend video
177
-     * option.
178
-     */
179
-    setSuspendVideo(constraints: any, enable: boolean): void;
180
 }
161
 }
181
 import Listenable from "../util/Listenable";
162
 import Listenable from "../util/Listenable";

Loading…
Cancel
Save