|
|
@@ -635,16 +635,17 @@ StatsCollector.prototype.processStatsReport = function () {
|
|
635
|
635
|
}
|
|
636
|
636
|
bytesSent = Math.max(0, bytesSent);
|
|
637
|
637
|
|
|
638
|
|
- var time = (now.timestamp - before.timestamp) / 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);
|
|
|
638
|
+ var timeMs = now.timestamp - before.timestamp;
|
|
|
639
|
+ var bitrateReceivedKbps = 0, bitrateSentKbps = 0;
|
|
|
640
|
+ if (timeMs > 0) {
|
|
|
641
|
+ // TODO is there any reason to round here?
|
|
|
642
|
+ bitrateReceivedKbps = Math.round((bytesReceived * 8) / timeMs);
|
|
|
643
|
+ bitrateSentKbps = Math.round((bytesSent * 8) / timeMs);
|
|
643
|
644
|
}
|
|
644
|
645
|
|
|
645
|
646
|
ssrcStats.setSsrcBitrate({
|
|
646
|
|
- "download": bitrateReceived,
|
|
647
|
|
- "upload": bitrateSent
|
|
|
647
|
+ "download": bitrateReceivedKbps,
|
|
|
648
|
+ "upload": bitrateSentKbps
|
|
648
|
649
|
});
|
|
649
|
650
|
|
|
650
|
651
|
var resolution = {height: null, width: null};
|