Skip to content

Commit 99a997b

Browse files
author
arthur
committed
fix: don't have packetsLost have packetsLostRate
1 parent 8b16fe4 commit 99a997b

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

dev/googCodecName.video.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ getStatsParser.checkVideoTracks = function(result) {
2525
kilobytes = bytes / 1024;
2626
}
2727

28-
if (!!result.packetsLost) {
29-
var kilolostPackets = 0;
30-
31-
if (!getStatsResult.internal.video[sendrecvType].prevLostPacket) {
32-
getStatsResult.internal.video[sendrecvType].prevLostPacket = result.packetsLost;
33-
}
34-
35-
var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket;
36-
kilolostPackets = packets / 1024
37-
}
38-
3928
if (!!result.bytesReceived) {
4029
var kilobytes = 0;
4130
if (!getStatsResult.internal.video[sendrecvType].prevBytesReceived) {
@@ -49,8 +38,18 @@ getStatsParser.checkVideoTracks = function(result) {
4938
}
5039

5140
getStatsResult.video[sendrecvType].availableBandwidth = kilobytes.toFixed(1);
52-
getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(1);
5341

42+
if (!!result.packetsLost) {
43+
var kilolostPackets = 0;
44+
45+
if (!getStatsResult.internal.video[sendrecvType].prevLostPacket) {
46+
getStatsResult.internal.video[sendrecvType].prevLostPacket = result.packetsLost;
47+
}
48+
49+
var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket;
50+
kilolostPackets = packets / 1024;
51+
getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(1);
52+
}
5453
if (result.googFrameHeightReceived && result.googFrameWidthReceived) {
5554
getStatsResult.resolutions[sendrecvType].width = result.googFrameWidthReceived;
5655
getStatsResult.resolutions[sendrecvType].height = result.googFrameHeightReceived;

getStats.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// Last time updated: 2018-08-30 6:37:37 AM UTC
3+
// Last time updated: 2018-08-30 9:15:50 AM UTC
44

55
// _______________
66
// getStats v1.0.7
@@ -311,17 +311,6 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
311311
kilobytes = bytes / 1024;
312312
}
313313

314-
if (!!result.packetsLost) {
315-
var kilolostPackets = 0;
316-
317-
if (!getStatsResult.internal.video[sendrecvType].prevLostPacket) {
318-
getStatsResult.internal.video[sendrecvType].prevLostPacket = result.packetsLost;
319-
}
320-
321-
var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket;
322-
kilolostPackets = packets / 1024
323-
}
324-
325314
if (!!result.bytesReceived) {
326315
var kilobytes = 0;
327316
if (!getStatsResult.internal.video[sendrecvType].prevBytesReceived) {
@@ -335,8 +324,18 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
335324
}
336325

337326
getStatsResult.video[sendrecvType].availableBandwidth = kilobytes.toFixed(1);
338-
getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(1);
339327

328+
if (!!result.packetsLost) {
329+
var kilolostPackets = 0;
330+
331+
if (!getStatsResult.internal.video[sendrecvType].prevLostPacket) {
332+
getStatsResult.internal.video[sendrecvType].prevLostPacket = result.packetsLost;
333+
}
334+
335+
var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket;
336+
kilolostPackets = packets / 1024;
337+
getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(1);
338+
}
340339
if (result.googFrameHeightReceived && result.googFrameWidthReceived) {
341340
getStatsResult.resolutions[sendrecvType].width = result.googFrameWidthReceived;
342341
getStatsResult.resolutions[sendrecvType].height = result.googFrameHeightReceived;

0 commit comments

Comments
 (0)