Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Load test: emulate Jitsi-Meet's lastN and selectParticipant behavior. (#8926)

Jonathan Lennox357bbd1158a1
diff --git a/resources/load-test/load-test-participant.js b/resources/load-test/load-test-participant.js
index 8c8f316b17..c519d06d7a 100644
--- a/resources/load-test/load-test-participant.js
+++ b/resources/load-test/load-test-participant.js
@@ -3,6 +3,7 @@ import 'jquery';
import { setConfigFromURLParams } from '../../react/features/base/config/functions';
import { parseURLParams } from '../../react/features/base/util/parseURLParams';
import { parseURIString } from '../../react/features/base/util/uri';
+import { validateLastNLimits, limitLastN } from '../../react/features/base/lastn/functions';
setConfigFromURLParams(config, {}, {}, window.location);
@@ -107,12 +108,35 @@ function updateMaxFrameHeight() {
}
}
+/**
+ * Simple emulation of jitsi-meet's lastN behavior
+ */
+function updateLastN() {
+ let lastN = typeof config.channelLastN === 'undefined' ? -1 : config.channelLastN;
+
+ const limitedLastN = limitLastN(numParticipants, validateLastNLimits(config.lastNLimits));
+
+ if (limitedLastN !== undefined) {
+ lastN = lastN === -1 ? limitedLastN : Math.min(limitedLastN, lastN);
+ }
+
+ if (lastN === room.getLastN()) {
+ return;
+ }
+
+ room.setLastN(lastN);
+}
+
/**
*
*/
function setNumberOfParticipants() {
$('#participants').text(numParticipants);
+ /* jitsi-meet's current Tile View behavior. */
+ const ids = room.getParticipants().map(participant => participant.id);
+ room.selectParticipants(ids);
updateMaxFrameHeight();
+ updateLastN();
}
/**
@@ -194,6 +218,16 @@ function onStartMuted() {
}, 2000);
}
+/**
+ *
+ * @param id
+ */
+function onUserJoined(id) {
+ numParticipants++;
+ setNumberOfParticipants();
+ remoteTracks[id] = [];
+}
+
/**
*
* @param id
@@ -224,11 +258,7 @@ function onConnectionSuccess() {
room.on(JitsiMeetJS.events.conference.STARTED_MUTED, onStartMuted);
room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
- room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
- numParticipants++;
- setNumberOfParticipants();
- remoteTracks[id] = [];
- });
+ room.on(JitsiMeetJS.events.conference.USER_JOINED, onUserJoined);
room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
const devices = [];