|
|
@@ -84,6 +84,12 @@ function Statistics(xmpp, options) {
|
|
84
|
84
|
}
|
|
85
|
85
|
Statistics.audioLevelsEnabled = false;
|
|
86
|
86
|
|
|
|
87
|
+/**
|
|
|
88
|
+ * Array of callstats instances. Used to call Statistics static methods and
|
|
|
89
|
+ * send stats to all cs instances.
|
|
|
90
|
+ */
|
|
|
91
|
+Statistics.callsStatsInstances = [];
|
|
|
92
|
+
|
|
87
|
93
|
Statistics.prototype.startRemoteStats = function (peerconnection) {
|
|
88
|
94
|
if(!Statistics.audioLevelsEnabled)
|
|
89
|
95
|
return;
|
|
|
@@ -194,6 +200,7 @@ Statistics.prototype.stopRemoteStats = function () {
|
|
194
|
200
|
Statistics.prototype.startCallStats = function (session, settings) {
|
|
195
|
201
|
if(this.callStatsIntegrationEnabled && !this.callstats) {
|
|
196
|
202
|
this.callstats = new CallStats(session, settings, this.options);
|
|
|
203
|
+ Statistics.callsStatsInstances.push(this.callstats);
|
|
197
|
204
|
}
|
|
198
|
205
|
};
|
|
199
|
206
|
|
|
|
@@ -270,29 +277,25 @@ function (ssrc, isLocal, usageLabel, containerId) {
|
|
270
|
277
|
*
|
|
271
|
278
|
* @param {Error} e error to send
|
|
272
|
279
|
*/
|
|
273
|
|
-Statistics.prototype.sendGetUserMediaFailed = function (e) {
|
|
274
|
|
- if(this.callstats) {
|
|
|
280
|
+Statistics.sendGetUserMediaFailed = function (e) {
|
|
|
281
|
+
|
|
|
282
|
+ if (Statistics.callsStatsInstances.length) {
|
|
|
283
|
+ Statistics.callsStatsInstances.forEach(function (cs) {
|
|
|
284
|
+ CallStats.sendGetUserMediaFailed(
|
|
|
285
|
+ e instanceof JitsiTrackError
|
|
|
286
|
+ ? formatJitsiTrackErrorForCallStats(e)
|
|
|
287
|
+ : e,
|
|
|
288
|
+ cs);
|
|
|
289
|
+ });
|
|
|
290
|
+ } else {
|
|
275
|
291
|
CallStats.sendGetUserMediaFailed(
|
|
276
|
292
|
e instanceof JitsiTrackError
|
|
277
|
293
|
? formatJitsiTrackErrorForCallStats(e)
|
|
278
|
294
|
: e,
|
|
279
|
|
- this.callstats);
|
|
|
295
|
+ null);
|
|
280
|
296
|
}
|
|
281
|
297
|
};
|
|
282
|
298
|
|
|
283
|
|
-/**
|
|
284
|
|
- * Notifies CallStats that getUserMedia failed.
|
|
285
|
|
- *
|
|
286
|
|
- * @param {Error} e error to send
|
|
287
|
|
- */
|
|
288
|
|
-Statistics.sendGetUserMediaFailed = function (e) {
|
|
289
|
|
- CallStats.sendGetUserMediaFailed(
|
|
290
|
|
- e instanceof JitsiTrackError
|
|
291
|
|
- ? formatJitsiTrackErrorForCallStats(e)
|
|
292
|
|
- : e,
|
|
293
|
|
- null);
|
|
294
|
|
-};
|
|
295
|
|
-
|
|
296
|
299
|
/**
|
|
297
|
300
|
* Notifies CallStats that peer connection failed to create offer.
|
|
298
|
301
|
*
|
|
|
@@ -348,24 +351,19 @@ Statistics.prototype.sendAddIceCandidateFailed = function (e, pc) {
|
|
348
|
351
|
CallStats.sendAddIceCandidateFailed(e, pc, this.callstats);
|
|
349
|
352
|
};
|
|
350
|
353
|
|
|
351
|
|
-/**
|
|
352
|
|
- * Notifies CallStats that there is an unhandled error on the page.
|
|
353
|
|
- *
|
|
354
|
|
- * @param {Error} e error to send
|
|
355
|
|
- * @param {RTCPeerConnection} pc connection on which failure occured.
|
|
356
|
|
- */
|
|
357
|
|
-Statistics.prototype.sendUnhandledError = function (e) {
|
|
358
|
|
- if(this.callstats)
|
|
359
|
|
- CallStats.sendUnhandledError(e, this.callstats);
|
|
360
|
|
-};
|
|
361
|
|
-
|
|
362
|
354
|
/**
|
|
363
|
355
|
* Notifies CallStats that there is unhandled exception.
|
|
364
|
356
|
*
|
|
365
|
357
|
* @param {Error} e error to send
|
|
366
|
358
|
*/
|
|
367
|
359
|
Statistics.sendUnhandledError = function (e) {
|
|
368
|
|
- CallStats.sendUnhandledError(e, null);
|
|
|
360
|
+ if (Statistics.callsStatsInstances.length) {
|
|
|
361
|
+ Statistics.callsStatsInstances.forEach(function (cs) {
|
|
|
362
|
+ CallStats.sendUnhandledError(e, cs);
|
|
|
363
|
+ });
|
|
|
364
|
+ } else {
|
|
|
365
|
+ CallStats.sendUnhandledError(e, null);
|
|
|
366
|
+ }
|
|
369
|
367
|
};
|
|
370
|
368
|
|
|
371
|
369
|
/**
|
|
|
@@ -375,7 +373,7 @@ Statistics.sendUnhandledError = function (e) {
|
|
375
|
373
|
*/
|
|
376
|
374
|
Statistics.sendLog = function (m) {
|
|
377
|
375
|
// uses the same field for cs stat as unhandled error
|
|
378
|
|
- CallStats.sendUnhandledError(m, null);
|
|
|
376
|
+ Statistics.sendUnhandledError(m);
|
|
379
|
377
|
};
|
|
380
|
378
|
|
|
381
|
379
|
/**
|
|
|
@@ -408,9 +406,9 @@ Statistics.LOCAL_JID = require("../../service/statistics/constants").LOCAL_JID;
|
|
408
|
406
|
*/
|
|
409
|
407
|
Statistics.reportGlobalError = function (error) {
|
|
410
|
408
|
if (error instanceof JitsiTrackError && error.gum) {
|
|
411
|
|
- this.sendGetUserMediaFailed(error);
|
|
|
409
|
+ Statistics.sendGetUserMediaFailed(error);
|
|
412
|
410
|
} else {
|
|
413
|
|
- this.sendUnhandledError(error);
|
|
|
411
|
+ Statistics.sendUnhandledError(error);
|
|
414
|
412
|
}
|
|
415
|
413
|
};
|
|
416
|
414
|
|