Quellcode durchsuchen

feat: add config property for P2P test mode

P2P test mode disables automatic switching to P2P when there are 2
participants in the room.
master
paweldomas vor 8 Jahren
Ursprung
Commit
2c82013f97
1 geänderte Dateien mit 14 neuen und 2 gelöschten Zeilen
  1. 14
    2
      JitsiConference.js

+ 14
- 2
JitsiConference.js Datei anzeigen

@@ -313,6 +313,16 @@ JitsiConference.prototype.isP2PEnabled = function() {
313 313
         || typeof this.options.config.p2p === 'undefined';
314 314
 };
315 315
 
316
+/**
317
+ * When in P2P test mode, the conference will not automatically switch to P2P
318
+ * when there 2 participants.
319
+ * @return {boolean}
320
+ */
321
+JitsiConference.prototype.isP2PTestModeEnabled = function() {
322
+    return Boolean(this.options.config.testing
323
+        && this.options.config.testing.p2pTestMode);
324
+};
325
+
316 326
 /**
317 327
  * Leaves the conference.
318 328
  * @returns {Promise}
@@ -1317,7 +1327,7 @@ JitsiConference.prototype.onIncomingCall
1317 1327
                     reasonMsg: 'P2P not supported',
1318 1328
                     errorMsg: 'This client does not support P2P connections'
1319 1329
                 });
1320
-        } else if (!this.isP2PEnabled()) {
1330
+        } else if (!this.isP2PEnabled() && !this.isP2PTestModeEnabled()) {
1321 1331
             this._rejectIncomingCall(
1322 1332
                 jingleSession, {
1323 1333
                     reasonTag: 'decline',
@@ -2317,7 +2327,9 @@ JitsiConference.prototype._suspendMediaTransferForJvbConnection = function() {
2317 2327
  * @private
2318 2328
  */
2319 2329
 JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2320
-    if (!RTCBrowserType.isP2PSupported() || !this.isP2PEnabled()) {
2330
+    if (!RTCBrowserType.isP2PSupported()
2331
+        || !this.isP2PEnabled()
2332
+        || this.isP2PTestModeEnabled()) {
2321 2333
         logger.info('Auto P2P disabled');
2322 2334
 
2323 2335
         return;

Laden…
Abbrechen
Speichern