|
@@ -876,10 +876,34 @@ class RTCUtils extends Listenable {
|
876
|
876
|
{ googSuspendBelowMinBitrate: true });
|
877
|
877
|
}
|
878
|
878
|
|
879
|
|
- // There's no reason not to use this for p2p
|
880
|
|
- this.p2pPcConstraints.optional.push({
|
881
|
|
- googSuspendBelowMinBitrate: true
|
882
|
|
- });
|
|
879
|
+ /**
|
|
880
|
+ * This option is used to enable the suspend video only for
|
|
881
|
+ * part of the users on the P2P peer connection. The value of
|
|
882
|
+ * the option is the ratio:
|
|
883
|
+ * (users with suspended video enabled)/(all users).
|
|
884
|
+ *
|
|
885
|
+ * Note: The option is not documented because it is temporary
|
|
886
|
+ * and only for internal testing purpose.
|
|
887
|
+ *
|
|
888
|
+ * @type {number}
|
|
889
|
+ */
|
|
890
|
+ const forceP2PSuspendVideoRatio
|
|
891
|
+ = options.testing.forceP2PSuspendVideoRatio;
|
|
892
|
+
|
|
893
|
+ // If <tt>forceP2PSuspendVideoRatio</tt> is invalid (not a
|
|
894
|
+ // number) fallback to the default behavior (enabled for every
|
|
895
|
+ // user).
|
|
896
|
+ if (typeof forceP2PSuspendVideoRatio !== 'number'
|
|
897
|
+ || Math.random() < forceP2PSuspendVideoRatio) {
|
|
898
|
+ logger.info(`Enable suspend video mode for p2p (ratio=${
|
|
899
|
+ forceP2PSuspendVideoRatio})`);
|
|
900
|
+ Statistics.analytics.addPermanentProperties({
|
|
901
|
+ forceP2PSuspendVideo: true
|
|
902
|
+ });
|
|
903
|
+ this.p2pPcConstraints.optional.push({
|
|
904
|
+ googSuspendBelowMinBitrate: true
|
|
905
|
+ });
|
|
906
|
+ }
|
883
|
907
|
} else if (RTCBrowserType.isEdge()) {
|
884
|
908
|
this.RTCPeerConnectionType = ortcRTCPeerConnection;
|
885
|
909
|
this.getUserMedia
|