Skip to content

Commit

Permalink
fix: result.bytesReceived !== '0'
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur committed Oct 19, 2018
1 parent 533e61f commit 08cb37f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
13 changes: 5 additions & 8 deletions dev/googCodecName.audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ getStatsParser.checkAudioTracks = function(result) {
}

// 当参数合并后,根据 bytesReceived 来判断recv/send
if (result.bytesReceived) {
var bytes = 0;
if (!!result.bytesReceived) {
if (!getStatsResult.internal.audio['recv'].prevBytesReceived) {
getStatsResult.internal.audio['recv'].prevBytesReceived = result.bytesReceived;
}

bytes = result.bytesReceived - getStatsResult.internal.audio['recv'].prevBytesReceived;
if (result.bytesReceived && result.bytesReceived !== '0') {
if (!getStatsResult.internal.audio['recv'].prevBytesReceived) {
getStatsResult.internal.audio['recv'].prevBytesReceived = result.bytesReceived;
}

var bytes = result.bytesReceived - getStatsResult.internal.audio['recv'].prevBytesReceived;
getStatsResult.internal.audio['recv'].prevBytesReceived = result.bytesReceived;
getStatsResult.audio['recv'].availableBandwidth = bytes;
}

Expand Down
2 changes: 1 addition & 1 deletion dev/googCodecName.video.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ getStatsParser.checkVideoTracks = function(result) {
}

// 当参数合并后,根据 bytesReceived 来判断recv/send
if (!!result.bytesReceived) {
if (!!result.bytesReceived && result.bytesReceived !== '0') {
var bytes = 0;
if (!getStatsResult.internal.video['recv'].prevBytesReceived || getStatsResult.internal.video['recv'].prevBytesReceived > result.bytesReceived) {
getStatsResult.internal.video['recv'].prevBytesReceived = result.bytesReceived;
Expand Down
17 changes: 7 additions & 10 deletions getStats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

// Last time updated: 2018-10-19 9:41:01 AM UTC
// Last time updated: 2018-10-19 11:13:46 AM UTC

// _______________
// getStats v1.0.10
Expand Down Expand Up @@ -332,16 +332,13 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
}

// 当参数合并后,根据 bytesReceived 来判断recv/send
if (result.bytesReceived) {
var bytes = 0;
if (!!result.bytesReceived) {
if (!getStatsResult.internal.audio['recv'].prevBytesReceived) {
getStatsResult.internal.audio['recv'].prevBytesReceived = result.bytesReceived;
}

bytes = result.bytesReceived - getStatsResult.internal.audio['recv'].prevBytesReceived;
if (result.bytesReceived && result.bytesReceived !== '0') {
if (!getStatsResult.internal.audio['recv'].prevBytesReceived) {
getStatsResult.internal.audio['recv'].prevBytesReceived = result.bytesReceived;
}

var bytes = result.bytesReceived - getStatsResult.internal.audio['recv'].prevBytesReceived;
getStatsResult.internal.audio['recv'].prevBytesReceived = result.bytesReceived;
getStatsResult.audio['recv'].availableBandwidth = bytes;
}

Expand Down Expand Up @@ -380,7 +377,7 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
}

// 当参数合并后,根据 bytesReceived 来判断recv/send
if (!!result.bytesReceived) {
if (!!result.bytesReceived && result.bytesReceived !== '0') {
var bytes = 0;
if (!getStatsResult.internal.video['recv'].prevBytesReceived || getStatsResult.internal.video['recv'].prevBytesReceived > result.bytesReceived) {
getStatsResult.internal.video['recv'].prevBytesReceived = result.bytesReceived;
Expand Down
4 changes: 2 additions & 2 deletions getStats.min.js

Large diffs are not rendered by default.

0 comments on commit 08cb37f

Please sign in to comment.