浏览代码

fix(stats): Skip bandwidth calc if there is no uplink/downlink bitrate.

This fixes an error that gets logged when no media is being sent/received by the endpoint.
Logger.js:154 2022-09-12T14:40:53.476Z [modules/statistics/AvgRTPStatsReporter.js] <xl.addNext>:  bandwidth_upload - invalid value for idx: 0
dev1
Jaya Allamsetty 3 年前
父节点
当前提交
ed2a0e64ff
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5
    3
      modules/statistics/AvgRTPStatsReporter.js

+ 5
- 3
modules/statistics/AvgRTPStatsReporter.js 查看文件

@@ -40,10 +40,12 @@ class AverageStatReport {
40 40
      * @param {number} nextValue
41 41
      */
42 42
     addNext(nextValue) {
43
+        if (typeof nextValue === 'undefined') {
44
+            return;
45
+        }
46
+
43 47
         if (typeof nextValue !== 'number') {
44
-            logger.error(
45
-                `${this.name} - invalid value for idx: ${this.count}`,
46
-                nextValue);
48
+            logger.error(`${this.name} - invalid value for idx: ${this.count}`, nextValue);
47 49
         } else if (!isNaN(nextValue)) {
48 50
             this.sum += nextValue;
49 51
             this.samples.push(nextValue);

正在加载...
取消
保存