Skip to content

Commit

Permalink
fix(stats): Skip bandwidth calc if there is no uplink/downlink bitrate.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jallamsetty1 committed Sep 12, 2022
1 parent bc3aae0 commit ed2a0e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/statistics/AvgRTPStatsReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ class AverageStatReport {
* @param {number} nextValue
*/
addNext(nextValue) {
if (typeof nextValue === 'undefined') {
return;
}

if (typeof nextValue !== 'number') {
logger.error(
`${this.name} - invalid value for idx: ${this.count}`,
nextValue);
logger.error(`${this.name} - invalid value for idx: ${this.count}`, nextValue);
} else if (!isNaN(nextValue)) {
this.sum += nextValue;
this.samples.push(nextValue);
Expand Down

0 comments on commit ed2a0e6

Please sign in to comment.