Browse Source

fix(AvgRTPStatsReporter): do not print error

If the current browser does not support given stat no error should be
printed.
tags/v0.0.2
paweldomas 8 years ago
parent
commit
fdbfec9b7a
2 changed files with 24 additions and 5 deletions
  1. 11
    0
      modules/RTC/RTCBrowserType.js
  2. 13
    5
      modules/statistics/AvgRTPStatsReporter.js

+ 11
- 0
modules/RTC/RTCBrowserType.js View File

@@ -207,6 +207,17 @@ const RTCBrowserType = {
207 207
         return RTCBrowserType.isFirefox();
208 208
     },
209 209
 
210
+    /**
211
+     * Checks if the current browser reports upload and download bandwidth
212
+     * statistics.
213
+     * @return {boolean}
214
+     */
215
+    supportsBandwidthStatistics() {
216
+        // FIXME bandwidth stats are currently not implemented for FF on our
217
+        // side, but not sure if not possible ?
218
+        return !RTCBrowserType.isFirefox();
219
+    },
220
+
210 221
     /**
211 222
      * Whether jitsi-meet supports simulcast on the current browser.
212 223
      * @returns {boolean}

+ 13
- 5
modules/statistics/AvgRTPStatsReporter.js View File

@@ -4,6 +4,7 @@ import { getLogger } from 'jitsi-meet-logger';
4 4
 import * as ConnectionQualityEvents
5 5
     from '../../service/connectivity/ConnectionQualityEvents';
6 6
 import * as ConferenceEvents from '../../JitsiConferenceEvents';
7
+import RTCBrowserType from '../RTC/RTCBrowserType';
7 8
 import Statistics from './statistics';
8 9
 
9 10
 const logger = getLogger(__filename);
@@ -32,7 +33,8 @@ class AverageStatReport {
32 33
     addNext(nextValue) {
33 34
         if (typeof nextValue !== 'number') {
34 35
             logger.error(
35
-                `${this.name} - invalid value for idx: ${this.count}`);
36
+                `${this.name} - invalid value for idx: ${this.count}`,
37
+                nextValue);
36 38
 
37 39
             return;
38 40
         }
@@ -268,8 +270,12 @@ export default class AvgRTPStatsReporter {
268 270
 
269 271
         this._avgBitrateUp.addNext(bitrate.upload);
270 272
         this._avgBitrateDown.addNext(bitrate.download);
271
-        this._avgBandwidthUp.addNext(bandwidth.upload);
272
-        this._avgBandwidthDown.addNext(bandwidth.download);
273
+
274
+        if (RTCBrowserType.supportsBandwidthStatistics()) {
275
+            this._avgBandwidthUp.addNext(bandwidth.upload);
276
+            this._avgBandwidthDown.addNext(bandwidth.download);
277
+        }
278
+
273 279
         this._avgPacketLossUp.addNext(packetLoss.upload);
274 280
         this._avgPacketLossDown.addNext(packetLoss.download);
275 281
         this._avgPacketLossTotal.addNext(packetLoss.total);
@@ -287,8 +293,10 @@ export default class AvgRTPStatsReporter {
287 293
         if (this._sampleIdx >= this._n) {
288 294
             this._avgBitrateUp.report(isP2P);
289 295
             this._avgBitrateDown.report(isP2P);
290
-            this._avgBandwidthUp.report(isP2P);
291
-            this._avgBandwidthDown.report(isP2P);
296
+            if (RTCBrowserType.supportsBandwidthStatistics()) {
297
+                this._avgBandwidthUp.report(isP2P);
298
+                this._avgBandwidthDown.report(isP2P);
299
+            }
292 300
             this._avgPacketLossUp.report(isP2P);
293 301
             this._avgPacketLossDown.report(isP2P);
294 302
             this._avgPacketLossTotal.report(isP2P);

Loading…
Cancel
Save