|
|
@@ -633,23 +633,18 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
633
|
633
|
}
|
|
634
|
634
|
}
|
|
635
|
635
|
}
|
|
|
636
|
+ bytesSent = Math.max(0, bytesSent);
|
|
636
|
637
|
|
|
637
|
638
|
var time = (now.timestamp - before.timestamp) / 1000;
|
|
638
|
|
- if (bytesReceived <= 0 || time <= 0) {
|
|
639
|
|
- bytesReceived = 0;
|
|
640
|
|
- } else {
|
|
641
|
|
- bytesReceived = Math.round(((bytesReceived * 8) / time) / 1000);
|
|
642
|
|
- }
|
|
643
|
|
-
|
|
644
|
|
- if (bytesSent <= 0 || time <= 0) {
|
|
645
|
|
- bytesSent = 0;
|
|
646
|
|
- } else {
|
|
647
|
|
- bytesSent = Math.round(((bytesSent * 8) / time) / 1000);
|
|
|
639
|
+ var bitrateReceived = 0, bitrateSent = 0;
|
|
|
640
|
+ if (time > 0) {
|
|
|
641
|
+ bitrateReceived = Math.round(((bytesReceived * 8) / time) / 1000);
|
|
|
642
|
+ bitrateSent = Math.round(((bytesSent * 8) / time) / 1000);
|
|
648
|
643
|
}
|
|
649
|
644
|
|
|
650
|
645
|
ssrcStats.setSsrcBitrate({
|
|
651
|
|
- "download": bytesReceived,
|
|
652
|
|
- "upload": bytesSent
|
|
|
646
|
+ "download": bitrateReceived,
|
|
|
647
|
+ "upload": bitrateSent
|
|
653
|
648
|
});
|
|
654
|
649
|
|
|
655
|
650
|
var resolution = {height: null, width: null};
|