|
@@ -219,69 +219,66 @@ StatsCollector.prototype.errorCallback = function (error)
|
219
|
219
|
StatsCollector.prototype.start = function ()
|
220
|
220
|
{
|
221
|
221
|
var self = this;
|
222
|
|
- this.audioLevelsIntervalId = setInterval(
|
223
|
|
- function ()
|
224
|
|
- {
|
225
|
|
- // Interval updates
|
226
|
|
- self.peerconnection.getStats(
|
227
|
|
- function (report)
|
228
|
|
- {
|
229
|
|
- var results = null;
|
230
|
|
- if(!report || !report.result || typeof report.result != 'function')
|
231
|
|
- {
|
232
|
|
- results = report;
|
233
|
|
- }
|
234
|
|
- else
|
235
|
|
- {
|
236
|
|
- results = report.result();
|
237
|
|
- }
|
238
|
|
- //console.error("Got interval report", results);
|
239
|
|
- self.currentAudioLevelsReport = results;
|
240
|
|
- self.processAudioLevelReport();
|
241
|
|
- self.baselineAudioLevelsReport =
|
242
|
|
- self.currentAudioLevelsReport;
|
243
|
|
- },
|
244
|
|
- self.errorCallback
|
245
|
|
- );
|
246
|
|
- },
|
247
|
|
- self.audioLevelsIntervalMilis
|
248
|
|
- );
|
249
|
|
-
|
250
|
|
- this.statsIntervalId = setInterval(
|
251
|
|
- function () {
|
252
|
|
- // Interval updates
|
253
|
|
- self.peerconnection.getStats(
|
254
|
|
- function (report)
|
255
|
|
- {
|
256
|
|
- var results = null;
|
257
|
|
- if(!report || !report.result || typeof report.result != 'function')
|
258
|
|
- {
|
259
|
|
- //firefox
|
260
|
|
- results = report;
|
261
|
|
- }
|
262
|
|
- else
|
263
|
|
- {
|
264
|
|
- //chrome
|
265
|
|
- results = report.result();
|
266
|
|
- }
|
267
|
|
- //console.error("Got interval report", results);
|
268
|
|
- self.currentStatsReport = results;
|
269
|
|
- try
|
270
|
|
- {
|
271
|
|
- self.processStatsReport();
|
272
|
|
- }
|
273
|
|
- catch (e)
|
274
|
|
- {
|
275
|
|
- console.error("Unsupported key:" + e, e);
|
276
|
|
- }
|
|
222
|
+ if(!config.disableAudioLevels) {
|
|
223
|
+ this.audioLevelsIntervalId = setInterval(
|
|
224
|
+ function () {
|
|
225
|
+ // Interval updates
|
|
226
|
+ self.peerconnection.getStats(
|
|
227
|
+ function (report) {
|
|
228
|
+ var results = null;
|
|
229
|
+ if (!report || !report.result ||
|
|
230
|
+ typeof report.result != 'function') {
|
|
231
|
+ results = report;
|
|
232
|
+ }
|
|
233
|
+ else {
|
|
234
|
+ results = report.result();
|
|
235
|
+ }
|
|
236
|
+ //console.error("Got interval report", results);
|
|
237
|
+ self.currentAudioLevelsReport = results;
|
|
238
|
+ self.processAudioLevelReport();
|
|
239
|
+ self.baselineAudioLevelsReport =
|
|
240
|
+ self.currentAudioLevelsReport;
|
|
241
|
+ },
|
|
242
|
+ self.errorCallback
|
|
243
|
+ );
|
|
244
|
+ },
|
|
245
|
+ self.audioLevelsIntervalMilis
|
|
246
|
+ );
|
|
247
|
+ }
|
277
|
248
|
|
278
|
|
- self.baselineStatsReport = self.currentStatsReport;
|
279
|
|
- },
|
280
|
|
- self.errorCallback
|
281
|
|
- );
|
282
|
|
- },
|
283
|
|
- self.statsIntervalMilis
|
284
|
|
- );
|
|
249
|
+ if(!config.disableStats) {
|
|
250
|
+ this.statsIntervalId = setInterval(
|
|
251
|
+ function () {
|
|
252
|
+ // Interval updates
|
|
253
|
+ self.peerconnection.getStats(
|
|
254
|
+ function (report) {
|
|
255
|
+ var results = null;
|
|
256
|
+ if (!report || !report.result ||
|
|
257
|
+ typeof report.result != 'function') {
|
|
258
|
+ //firefox
|
|
259
|
+ results = report;
|
|
260
|
+ }
|
|
261
|
+ else {
|
|
262
|
+ //chrome
|
|
263
|
+ results = report.result();
|
|
264
|
+ }
|
|
265
|
+ //console.error("Got interval report", results);
|
|
266
|
+ self.currentStatsReport = results;
|
|
267
|
+ try {
|
|
268
|
+ self.processStatsReport();
|
|
269
|
+ }
|
|
270
|
+ catch (e) {
|
|
271
|
+ console.error("Unsupported key:" + e, e);
|
|
272
|
+ }
|
|
273
|
+
|
|
274
|
+ self.baselineStatsReport = self.currentStatsReport;
|
|
275
|
+ },
|
|
276
|
+ self.errorCallback
|
|
277
|
+ );
|
|
278
|
+ },
|
|
279
|
+ self.statsIntervalMilis
|
|
280
|
+ );
|
|
281
|
+ }
|
285
|
282
|
|
286
|
283
|
if (config.logStats) {
|
287
|
284
|
this.gatherStatsIntervalId = setInterval(
|