Browse Source

squash: Use different function syntax.

dev1
Boris Grozev 5 years ago
parent
commit
5796d83bb1
1 changed files with 9 additions and 14 deletions
  1. 9
    14
      modules/statistics/RTPStatsCollector.js

+ 9
- 14
modules/statistics/RTPStatsCollector.js View File

301
  * Starts stats updates.
301
  * Starts stats updates.
302
  */
302
  */
303
 StatsCollector.prototype.start = function(startAudioLevelStats) {
303
 StatsCollector.prototype.start = function(startAudioLevelStats) {
304
-    const self = this;
305
-
306
     if (startAudioLevelStats) {
304
     if (startAudioLevelStats) {
307
         if (browser.supportsReceiverStats()) {
305
         if (browser.supportsReceiverStats()) {
308
             logger.info('Using RTCRtpSynchronizationSource for remote audio levels');
306
             logger.info('Using RTCRtpSynchronizationSource for remote audio levels');
356
         );
354
         );
357
     }
355
     }
358
 
356
 
359
-    /**
360
-     * Call getStats on the PeerConnection and process the result.
361
-     */
362
-    function processStats() {
357
+    const processStats = () => {
363
         // Interval updates
358
         // Interval updates
364
-        self.peerconnection.getStats(
359
+        this.peerconnection.getStats(
365
             report => {
360
             report => {
366
                 let results = null;
361
                 let results = null;
367
 
362
 
374
                     results = report.result();
369
                     results = report.result();
375
                 }
370
                 }
376
 
371
 
377
-                self.currentStatsReport = results;
372
+                this.currentStatsReport = results;
378
                 try {
373
                 try {
379
-                    if (self._usesPromiseGetStats) {
380
-                        self.processNewStatsReport();
374
+                    if (this._usesPromiseGetStats) {
375
+                        this.processNewStatsReport();
381
                     } else {
376
                     } else {
382
-                        self.processStatsReport();
377
+                        this.processStatsReport();
383
                     }
378
                     }
384
                 } catch (e) {
379
                 } catch (e) {
385
                     GlobalOnErrorHandler.callErrorHandler(e);
380
                     GlobalOnErrorHandler.callErrorHandler(e);
386
                     logger.error(`Unsupported key:${e}`, e);
381
                     logger.error(`Unsupported key:${e}`, e);
387
                 }
382
                 }
388
 
383
 
389
-                self.previousStatsReport = self.currentStatsReport;
384
+                this.previousStatsReport = this.currentStatsReport;
390
             },
385
             },
391
-            error => self.errorCallback(error)
386
+            error => this.errorCallback(error)
392
         );
387
         );
393
-    }
388
+    };
394
 
389
 
395
     processStats();
390
     processStats();
396
     this.statsIntervalId = setInterval(processStats, this.statsIntervalMilis);
391
     this.statsIntervalId = setInterval(processStats, this.statsIntervalMilis);

Loading…
Cancel
Save