Only show FL/PL percentage when it's > 1%

This commit is contained in:
redphx
2024-12-24 06:31:40 +07:00
parent 57fb22b905
commit c1786d3fba
3 changed files with 12 additions and 12 deletions

View File

@@ -2243,16 +2243,16 @@ class StreamStatsCollector {
received: 0,
dropped: 0,
toString() {
let framesDroppedPercentage = (this.dropped * 100 / (this.dropped + this.received || 1)).toFixed(1);
return framesDroppedPercentage === "0.0" ? this.dropped.toString() : `${this.dropped} (${framesDroppedPercentage}%)`;
let percentage = (this.dropped * 100 / (this.dropped + this.received || 1)).toFixed(1);
return percentage.startsWith("0.") ? this.dropped.toString() : `${this.dropped} (${percentage}%)`;
}
},
pl: {
received: 0,
dropped: 0,
toString() {
let packetsLostPercentage = (this.dropped * 100 / (this.dropped + this.received || 1)).toFixed(1);
return packetsLostPercentage === "0.0" ? this.dropped.toString() : `${this.dropped} (${packetsLostPercentage}%)`;
let percentage = (this.dropped * 100 / (this.dropped + this.received || 1)).toFixed(1);
return percentage.startsWith("0.") ? this.dropped.toString() : `${this.dropped} (${percentage}%)`;
}
},
dt: {