Преглед изворни кода

Load test: send video constraints only after ICE is connected. (#8952)

j8
Jonathan Lennox пре 4 година
родитељ
комит
9662b2ae67
No account linked to committer's email address
1 измењених фајлова са 35 додато и 3 уклоњено
  1. 35
    3
      resources/load-test/load-test-participant.js

+ 35
- 3
resources/load-test/load-test-participant.js Прегледај датотеку

@@ -24,6 +24,8 @@ const { room: roomName } = parseURIString(window.location.toString());
24 24
 
25 25
 let connection = null;
26 26
 
27
+let connected = false;
28
+
27 29
 let room = null;
28 30
 
29 31
 let numParticipants = 1;
@@ -92,6 +94,10 @@ window.APP = {
92 94
  * Simple emulation of jitsi-meet's screen layout behavior
93 95
  */
94 96
 function updateMaxFrameHeight() {
97
+    if (!connected) {
98
+        return;
99
+    }
100
+
95 101
     let newMaxFrameHeight;
96 102
 
97 103
     if (numParticipants <= 2) {
@@ -112,6 +118,10 @@ function updateMaxFrameHeight() {
112 118
  * Simple emulation of jitsi-meet's lastN behavior
113 119
  */
114 120
 function updateLastN() {
121
+    if (!connected) {
122
+        return;
123
+    }
124
+
115 125
     let lastN = typeof config.channelLastN === 'undefined' ? -1 : config.channelLastN;
116 126
 
117 127
     const limitedLastN = limitLastN(numParticipants, validateLastNLimits(config.lastNLimits));
@@ -128,13 +138,34 @@ function updateLastN() {
128 138
 }
129 139
 
130 140
 /**
131
- *
141
+ * Simple emulation of jitsi-meet's selectParticipants behavior
132 142
  */
133
-function setNumberOfParticipants() {
134
-    $('#participants').text(numParticipants);
143
+function selectParticipants() {
144
+    if (!connected) {
145
+        return;
146
+    }
135 147
     /* jitsi-meet's current Tile View behavior. */
136 148
     const ids = room.getParticipants().map(participant => participant.getId());
137 149
     room.selectParticipants(ids);
150
+}
151
+
152
+/**
153
+ * Called when number of participants changes.
154
+ */
155
+function setNumberOfParticipants() {
156
+    $('#participants').text(numParticipants);
157
+    selectParticipants();
158
+    updateMaxFrameHeight();
159
+    updateLastN();
160
+}
161
+
162
+/**
163
+ * Called when ICE connects
164
+ */
165
+function onConnectionEstablished() {
166
+    connected = true;
167
+
168
+    selectParticipants();
138 169
     updateMaxFrameHeight();
139 170
     updateLastN();
140 171
 }
@@ -258,6 +289,7 @@ function onConnectionSuccess() {
258 289
     room.on(JitsiMeetJS.events.conference.STARTED_MUTED, onStartMuted);
259 290
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
260 291
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
292
+    room.on(JitsiMeetJS.events.conference.CONNECTION_ESTABLISHED, onConnectionEstablished);
261 293
     room.on(JitsiMeetJS.events.conference.USER_JOINED, onUserJoined);
262 294
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
263 295
 

Loading…
Откажи
Сачувај