Skip to content

Commit aa53fd4

Browse files
author
arthur
committed
fix: kilobytes is zero
1 parent 877d113 commit aa53fd4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

dev/googCodecName.video.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ getStatsParser.checkVideoTracks = function(result) {
4848

4949
var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket;
5050
kilolostPackets = packets / 1024;
51-
getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(4) * 100 + "%";
51+
getStatsResult.video[sendrecvType].packetsLostRate = kilobytes != 0 ? (kilolostPackets / kilobytes).toFixed(4) * 100 + "%" : '0.00%';
5252
}
5353
if (result.googFrameHeightReceived && result.googFrameWidthReceived) {
5454
getStatsResult.resolutions[sendrecvType].width = result.googFrameWidthReceived;

getStats.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// Last time updated: 2018-08-30 9:35:45 AM UTC
3+
// Last time updated: 2018-08-31 9:46:30 AM UTC
44

55
// _______________
66
// getStats v1.0.7
@@ -334,7 +334,7 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
334334

335335
var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket;
336336
kilolostPackets = packets / 1024;
337-
getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(4) * 100 + "%";
337+
getStatsResult.video[sendrecvType].packetsLostRate = kilobytes != 0 ? (kilolostPackets / kilobytes).toFixed(4) * 100 + "%" : '0.00%';
338338
}
339339
if (result.googFrameHeightReceived && result.googFrameWidthReceived) {
340340
getStatsResult.resolutions[sendrecvType].width = result.googFrameWidthReceived;

0 commit comments

Comments
 (0)