Przeglądaj źródła

fix: crash if GUM not called

Fixes crash on undefined var in case get user media was not called,
before the conference started.
master
paweldomas 8 lat temu
rodzic
commit
6f45fa5763
2 zmienionych plików z 15 dodań i 2 usunięć
  1. 6
    0
      JitsiMeetJS.js
  2. 9
    2
      modules/RTC/JitsiRemoteTrack.js

+ 6
- 0
JitsiMeetJS.js Wyświetl plik

@@ -118,6 +118,12 @@ export default {
118 118
     init(options) {
119 119
         Statistics.init(options);
120 120
 
121
+        // Initialize global window.connectionTimes
122
+        // FIXME do not use 'window'
123
+        if (!window.connectionTimes) {
124
+            window.connectionTimes = {};
125
+        }
126
+
121 127
         this.analytics = Statistics.analytics;
122 128
         if (options.enableAnalyticsLogging === true) {
123 129
             this.analytics.init(RTCBrowserType.getBrowserName());

+ 9
- 2
modules/RTC/JitsiRemoteTrack.js Wyświetl plik

@@ -214,11 +214,18 @@ export default class JitsiRemoteTrack extends JitsiTrack {
214 214
         console.log(`(TIME) Render ${type}:\t`, now);
215 215
         this.conference.getConnectionTimes()[`${type}.render`] = now;
216 216
 
217
+        // The conference can be started without calling GUM
218
+        // FIXME if there would be a module for connection times this kind
219
+        // of logic (gumDuration or ttfm) should end up there
220
+        const gumStart = window.connectionTimes['obtainPermissions.start'];
221
+        const gumEnd = window.connectionTimes['obtainPermissions.end'];
222
+        const gumDuration
223
+            = !isNaN(gumEnd) && !isNaN(gumStart) ? gumEnd - gumStart : 0;
224
+
217 225
         const ttfm = now
218 226
             - (this.conference.getConnectionTimes()['session.initiate']
219 227
             - this.conference.getConnectionTimes()['muc.joined'])
220
-            - (window.connectionTimes['obtainPermissions.end']
221
-            - window.connectionTimes['obtainPermissions.start']);
228
+            - gumDuration;
222 229
 
223 230
         this.conference.getConnectionTimes()[`${type}.ttfm`] = ttfm;
224 231
         console.log(`(TIME) TTFM ${type}:\t`, ttfm);

Ładowanie…
Anuluj
Zapisz