From aa53fd4e77b651676da92d7dcd2d1c1779d9389a Mon Sep 17 00:00:00 2001 From: arthur Date: Fri, 31 Aug 2018 17:46:38 +0800 Subject: [PATCH] fix: kilobytes is zero --- dev/googCodecName.video.js | 2 +- getStats.js | 4 ++-- getStats.min.js | 4 ++-- yarn-error.log | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/googCodecName.video.js b/dev/googCodecName.video.js index 87c6208..51c1b05 100644 --- a/dev/googCodecName.video.js +++ b/dev/googCodecName.video.js @@ -48,7 +48,7 @@ getStatsParser.checkVideoTracks = function(result) { var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket; kilolostPackets = packets / 1024; - getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(4) * 100 + "%"; + getStatsResult.video[sendrecvType].packetsLostRate = kilobytes != 0 ? (kilolostPackets / kilobytes).toFixed(4) * 100 + "%" : '0.00%'; } if (result.googFrameHeightReceived && result.googFrameWidthReceived) { getStatsResult.resolutions[sendrecvType].width = result.googFrameWidthReceived; diff --git a/getStats.js b/getStats.js index 45fd245..7439ae4 100755 --- a/getStats.js +++ b/getStats.js @@ -1,6 +1,6 @@ 'use strict'; -// Last time updated: 2018-08-30 9:35:45 AM UTC +// Last time updated: 2018-08-31 9:46:30 AM UTC // _______________ // getStats v1.0.7 @@ -334,7 +334,7 @@ window.getStats = function(mediaStreamTrack, callback, interval) { var packets = result.packetsLost - getStatsResult.internal.video[sendrecvType].prevLostPacket; kilolostPackets = packets / 1024; - getStatsResult.video[sendrecvType].packetsLostRate = (kilolostPackets / kilobytes).toFixed(4) * 100 + "%"; + getStatsResult.video[sendrecvType].packetsLostRate = kilobytes != 0 ? (kilolostPackets / kilobytes).toFixed(4) * 100 + "%" : '0.00%'; } if (result.googFrameHeightReceived && result.googFrameWidthReceived) { getStatsResult.resolutions[sendrecvType].width = result.googFrameWidthReceived; diff --git a/getStats.min.js b/getStats.min.js index 72f3a53..6b6d4c4 100644 --- a/getStats.min.js +++ b/getStats.min.js @@ -1,6 +1,6 @@ 'use strict'; -// Last time updated: 2018-08-30 9:35:45 AM UTC +// Last time updated: 2018-08-31 9:46:30 AM UTC // _______________ // getStats v1.0.7 @@ -12,4 +12,4 @@ // MIT License - www.WebRTC-Experiment.com/licence // -------------------------------------------------- -"use strict";window.getStats=function(mediaStreamTrack,callback,interval){function getStatsLooper(){getStatsWrapper(function(results){results.forEach(function(result){Object.keys(getStatsParser).forEach(function(key){"function"==typeof getStatsParser[key]&&getStatsParser[key](result)}),"local-candidate"!==result.type&&"remote-candidate"!==result.type&&"candidate-pair"!==result.type});try{peer.iceConnectionState.search(/failed/gi)!==-1&&(nomore=!0)}catch(e){nomore=!0}nomore===!0&&(getStatsResult.datachannel&&(getStatsResult.datachannel.state="close"),getStatsResult.ended=!0),getStatsResult.results=results,getStatsResult.audio&&getStatsResult.video&&(getStatsResult.bandwidth.speed=getStatsResult.audio.bytesSent-getStatsResult.bandwidth.helper.audioBytesSent+(getStatsResult.video.bytesSent-getStatsResult.bandwidth.helper.videoBytesSent),getStatsResult.bandwidth.helper.audioBytesSent=getStatsResult.audio.bytesSent,getStatsResult.bandwidth.helper.videoBytesSent=getStatsResult.video.bytesSent),callback(getStatsResult),nomore||void 0!=typeof interval&&interval&&setTimeout(getStatsLooper,interval||1e3)})}function getStatsWrapper(cb){"undefined"!=typeof window.InstallTrigger?peer.getStats(mediaStreamTrack,function(res){var items=[];res.forEach(function(r){items.push(r)}),cb(items)},cb):peer.getStats(function(res){var items=[];res.result().forEach(function(res){var item={};res.names().forEach(function(name){item[name]=res.stat(name)}),item.id=res.id,item.type=res.type,item.timestamp=res.timestamp,items.push(item)}),cb(items)})}var RTCPeerConnection=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;"undefined"==typeof MediaStreamTrack&&(MediaStreamTrack={});var systemNetworkType=((navigator.connection||{}).type||"unknown").toString().toLowerCase(),getStatsResult={encryption:"sha-256",audio:{send:{tracks:[],codecs:[],availableBandwidth:0,streams:0},recv:{tracks:[],codecs:[],availableBandwidth:0,streams:0},bytesSent:0,bytesReceived:0},video:{send:{tracks:[],codecs:[],availableBandwidth:0,streams:0},recv:{tracks:[],codecs:[],availableBandwidth:0,streams:0},bytesSent:0,bytesReceived:0},bandwidth:{systemBandwidth:0,sentPerSecond:0,encodedPerSecond:0,helper:{audioBytesSent:0,videoBytestSent:0},speed:0},results:{},connectionType:{systemNetworkType:systemNetworkType,systemIpAddress:"192.168.1.2",local:{candidateType:[],transport:[],ipAddress:[],networkType:[]},remote:{candidateType:[],transport:[],ipAddress:[],networkType:[]}},resolutions:{send:{width:0,height:0},recv:{width:0,height:0}},internal:{audio:{send:{},recv:{}},video:{send:{},recv:{}},candidates:{}},nomore:function(){nomore=!0}},getStatsParser={checkIfOfferer:function(result){"googLibjingleSession"===result.type&&(getStatsResult.isOfferer=result.googInitiator)}},peer=this;if(arguments[0]instanceof RTCPeerConnection){if(peer=arguments[0],navigator.mozGetUserMedia&&(mediaStreamTrack=arguments[1],callback=arguments[2],interval=arguments[3]),!(mediaStreamTrack instanceof MediaStreamTrack)&&navigator.mozGetUserMedia)throw"2nd argument is not instance of MediaStreamTrack."}else if(!(mediaStreamTrack instanceof MediaStreamTrack)&&navigator.mozGetUserMedia)throw"1st argument is not instance of MediaStreamTrack.";var nomore=!1;getStatsParser.datachannel=function(result){"datachannel"===result.type&&(getStatsResult.datachannel={state:result.state})},getStatsParser.googCertificate=function(result){"googCertificate"==result.type&&(getStatsResult.encryption=result.googFingerprintAlgorithm)};var AUDIO_codecs=["opus","isac","ilbc"];getStatsParser.checkAudioTracks=function(result){if(result.googCodecName&&"audio"===result.mediaType&&AUDIO_codecs.indexOf(result.googCodecName.toLowerCase())!==-1){var sendrecvType=result.id.split("_").pop();if(getStatsResult.audio[sendrecvType].codecs.indexOf(result.googCodecName)===-1&&getStatsResult.audio[sendrecvType].codecs.push(result.googCodecName),result.bytesSent){var kilobytes=0;if(result.bytesSent){getStatsResult.internal.audio[sendrecvType].prevBytesSent||(getStatsResult.internal.audio[sendrecvType].prevBytesSent=result.bytesSent);var bytes=result.bytesSent-getStatsResult.internal.audio[sendrecvType].prevBytesSent;getStatsResult.internal.audio[sendrecvType].prevBytesSent=result.bytesSent,kilobytes=bytes/1024}getStatsResult.audio[sendrecvType].availableBandwidth=kilobytes.toFixed(1)}if(result.bytesReceived){var kilobytes=0;if(result.bytesReceived){getStatsResult.internal.audio[sendrecvType].prevBytesReceived||(getStatsResult.internal.audio[sendrecvType].prevBytesReceived=result.bytesReceived);var bytes=result.bytesReceived-getStatsResult.internal.audio[sendrecvType].prevBytesReceived;getStatsResult.internal.audio[sendrecvType].prevBytesReceived=result.bytesReceived,kilobytes=bytes/1024}getStatsResult.audio[sendrecvType].availableBandwidth=kilobytes.toFixed(1)}getStatsResult.audio[sendrecvType].tracks.indexOf(result.googTrackId)===-1&&getStatsResult.audio[sendrecvType].tracks.push(result.googTrackId)}};var VIDEO_codecs=["vp9","vp8","h264"];getStatsParser.checkVideoTracks=function(result){if(result.googCodecName&&"video"===result.mediaType&&VIDEO_codecs.indexOf(result.googCodecName.toLowerCase())!==-1){var sendrecvType=result.id.split("_").pop();if(getStatsResult.video[sendrecvType].codecs.indexOf(result.googCodecName)===-1&&getStatsResult.video[sendrecvType].codecs.push(result.googCodecName),result.bytesSent){var kilobytes=0;getStatsResult.internal.video[sendrecvType].prevBytesSent||(getStatsResult.internal.video[sendrecvType].prevBytesSent=result.bytesSent);var bytes=result.bytesSent-getStatsResult.internal.video[sendrecvType].prevBytesSent;getStatsResult.internal.video[sendrecvType].prevBytesSent=result.bytesSent,kilobytes=bytes/1024}if(result.bytesReceived){var kilobytes=0;getStatsResult.internal.video[sendrecvType].prevBytesReceived||(getStatsResult.internal.video[sendrecvType].prevBytesReceived=result.bytesReceived);var bytes=result.bytesReceived-getStatsResult.internal.video[sendrecvType].prevBytesReceived;getStatsResult.internal.video[sendrecvType].prevBytesReceived=result.bytesReceived,kilobytes=bytes/1024}if(getStatsResult.video[sendrecvType].availableBandwidth=kilobytes.toFixed(1),result.packetsLost){var kilolostPackets=0;getStatsResult.internal.video[sendrecvType].prevLostPacket||(getStatsResult.internal.video[sendrecvType].prevLostPacket=result.packetsLost);var packets=result.packetsLost-getStatsResult.internal.video[sendrecvType].prevLostPacket;kilolostPackets=packets/1024,getStatsResult.video[sendrecvType].packetsLostRate=100*(kilolostPackets/kilobytes).toFixed(4)+"%"}result.googFrameHeightReceived&&result.googFrameWidthReceived&&(getStatsResult.resolutions[sendrecvType].width=result.googFrameWidthReceived,getStatsResult.resolutions[sendrecvType].height=result.googFrameHeightReceived),result.googFrameHeightSent&&result.googFrameWidthSent&&(getStatsResult.resolutions[sendrecvType].width=result.googFrameWidthSent,getStatsResult.resolutions[sendrecvType].height=result.googFrameHeightSent),getStatsResult.video[sendrecvType].tracks.indexOf(result.googTrackId)===-1&&getStatsResult.video[sendrecvType].tracks.push(result.googTrackId)}},getStatsParser.bweforvideo=function(result){"VideoBwe"===result.type&&(getStatsResult.bandwidth.availableSendBandwidth=result.googAvailableSendBandwidth,getStatsResult.bandwidth.googActualEncBitrate=result.googActualEncBitrate,getStatsResult.bandwidth.googAvailableSendBandwidth=result.googAvailableSendBandwidth,getStatsResult.bandwidth.googAvailableReceiveBandwidth=result.googAvailableReceiveBandwidth,getStatsResult.bandwidth.googRetransmitBitrate=result.googRetransmitBitrate,getStatsResult.bandwidth.googTargetEncBitrate=result.googTargetEncBitrate,getStatsResult.bandwidth.googBucketDelay=result.googBucketDelay,getStatsResult.bandwidth.googTransmitBitrate=result.googTransmitBitrate)},getStatsParser.candidatePair=function(result){if("googCandidatePair"===result.type||"candidate-pair"===result.type){if("true"==result.googActiveConnection){Object.keys(getStatsResult.internal.candidates).forEach(function(cid){var candidate=getStatsResult.internal.candidates[cid];candidate.ipAddress.indexOf(result.googLocalAddress)!==-1&&(getStatsResult.connectionType.local.candidateType=candidate.candidateType,getStatsResult.connectionType.local.ipAddress=candidate.ipAddress,getStatsResult.connectionType.local.networkType=candidate.networkType,getStatsResult.connectionType.local.transport=candidate.transport),candidate.ipAddress.indexOf(result.googRemoteAddress)!==-1&&(getStatsResult.connectionType.remote.candidateType=candidate.candidateType,getStatsResult.connectionType.remote.ipAddress=candidate.ipAddress,getStatsResult.connectionType.remote.networkType=candidate.networkType,getStatsResult.connectionType.remote.transport=candidate.transport)}),getStatsResult.connectionType.transport=result.googTransportType;var localCandidate=getStatsResult.internal.candidates[result.localCandidateId];localCandidate&&localCandidate.ipAddress&&(getStatsResult.connectionType.systemIpAddress=localCandidate.ipAddress);var remoteCandidate=getStatsResult.internal.candidates[result.remoteCandidateId];remoteCandidate&&remoteCandidate.ipAddress&&(getStatsResult.connectionType.systemIpAddress=remoteCandidate.ipAddress)}if("candidate-pair"===result.type&&result.selected===!0&&result.nominated===!0&&"succeeded"===result.state)var localCandidate=getStatsResult.internal.candidates[result.remoteCandidateId],remoteCandidate=getStatsResult.internal.candidates[result.remoteCandidateId]}};var LOCAL_candidateType={},LOCAL_transport={},LOCAL_ipAddress={},LOCAL_networkType={};getStatsParser.localcandidate=function(result){"localcandidate"!==result.type&&"local-candidate"!==result.type||result.id&&(LOCAL_candidateType[result.id]||(LOCAL_candidateType[result.id]=[]),LOCAL_transport[result.id]||(LOCAL_transport[result.id]=[]),LOCAL_ipAddress[result.id]||(LOCAL_ipAddress[result.id]=[]),LOCAL_networkType[result.id]||(LOCAL_networkType[result.id]=[]),result.candidateType&&LOCAL_candidateType[result.id].indexOf(result.candidateType)===-1&&LOCAL_candidateType[result.id].push(result.candidateType),result.transport&&LOCAL_transport[result.id].indexOf(result.transport)===-1&&LOCAL_transport[result.id].push(result.transport),result.ipAddress&&LOCAL_ipAddress[result.id].indexOf(result.ipAddress+":"+result.portNumber)===-1&&LOCAL_ipAddress[result.id].push(result.ipAddress+":"+result.portNumber),result.networkType&&LOCAL_networkType[result.id].indexOf(result.networkType)===-1&&LOCAL_networkType[result.id].push(result.networkType),getStatsResult.internal.candidates[result.id]={candidateType:LOCAL_candidateType[result.id],ipAddress:LOCAL_ipAddress[result.id],portNumber:result.portNumber,networkType:LOCAL_networkType[result.id],priority:result.priority,transport:LOCAL_transport[result.id],timestamp:result.timestamp,id:result.id,type:result.type},getStatsResult.connectionType.local.candidateType=LOCAL_candidateType[result.id],getStatsResult.connectionType.local.ipAddress=LOCAL_ipAddress[result.id],getStatsResult.connectionType.local.networkType=LOCAL_networkType[result.id],getStatsResult.connectionType.local.transport=LOCAL_transport[result.id])};var REMOTE_candidateType={},REMOTE_transport={},REMOTE_ipAddress={},REMOTE_networkType={};getStatsParser.remotecandidate=function(result){"remotecandidate"!==result.type&&"remote-candidate"!==result.type||result.id&&(REMOTE_candidateType[result.id]||(REMOTE_candidateType[result.id]=[]),REMOTE_transport[result.id]||(REMOTE_transport[result.id]=[]),REMOTE_ipAddress[result.id]||(REMOTE_ipAddress[result.id]=[]),REMOTE_networkType[result.id]||(REMOTE_networkType[result.id]=[]),result.candidateType&&REMOTE_candidateType[result.id].indexOf(result.candidateType)===-1&&REMOTE_candidateType[result.id].push(result.candidateType),result.transport&&REMOTE_transport[result.id].indexOf(result.transport)===-1&&REMOTE_transport[result.id].push(result.transport),result.ipAddress&&REMOTE_ipAddress[result.id].indexOf(result.ipAddress+":"+result.portNumber)===-1&&REMOTE_ipAddress[result.id].push(result.ipAddress+":"+result.portNumber),result.networkType&&REMOTE_networkType[result.id].indexOf(result.networkType)===-1&&REMOTE_networkType[result.id].push(result.networkType),getStatsResult.internal.candidates[result.id]={candidateType:REMOTE_candidateType[result.id],ipAddress:REMOTE_ipAddress[result.id],portNumber:result.portNumber,networkType:REMOTE_networkType[result.id],priority:result.priority,transport:REMOTE_transport[result.id],timestamp:result.timestamp,id:result.id,type:result.type},getStatsResult.connectionType.remote.candidateType=REMOTE_candidateType[result.id],getStatsResult.connectionType.remote.ipAddress=REMOTE_ipAddress[result.id],getStatsResult.connectionType.remote.networkType=REMOTE_networkType[result.id],getStatsResult.connectionType.remote.transport=REMOTE_transport[result.id])},getStatsParser.dataSentReceived=function(result){!result.googCodecName||"video"!==result.mediaType&&"audio"!==result.mediaType||(result.bytesSent&&(getStatsResult[result.mediaType].bytesSent=parseInt(result.bytesSent)),result.bytesReceived&&(getStatsResult[result.mediaType].bytesReceived=parseInt(result.bytesReceived)))};var SSRC={audio:{send:[],recv:[]},video:{send:[],recv:[]}};getStatsParser.ssrc=function(result){if(result.googCodecName&&("video"===result.mediaType||"audio"===result.mediaType)&&"ssrc"===result.type){var sendrecvType=result.id.split("_").pop();SSRC[result.mediaType][sendrecvType].indexOf(result.ssrc)===-1&&SSRC[result.mediaType][sendrecvType].push(result.ssrc),getStatsResult[result.mediaType][sendrecvType].streams=SSRC[result.mediaType][sendrecvType].length}},getStatsLooper()}; \ No newline at end of file +"use strict";window.getStats=function(mediaStreamTrack,callback,interval){function getStatsLooper(){getStatsWrapper(function(results){results.forEach(function(result){Object.keys(getStatsParser).forEach(function(key){"function"==typeof getStatsParser[key]&&getStatsParser[key](result)}),"local-candidate"!==result.type&&"remote-candidate"!==result.type&&"candidate-pair"!==result.type});try{peer.iceConnectionState.search(/failed/gi)!==-1&&(nomore=!0)}catch(e){nomore=!0}nomore===!0&&(getStatsResult.datachannel&&(getStatsResult.datachannel.state="close"),getStatsResult.ended=!0),getStatsResult.results=results,getStatsResult.audio&&getStatsResult.video&&(getStatsResult.bandwidth.speed=getStatsResult.audio.bytesSent-getStatsResult.bandwidth.helper.audioBytesSent+(getStatsResult.video.bytesSent-getStatsResult.bandwidth.helper.videoBytesSent),getStatsResult.bandwidth.helper.audioBytesSent=getStatsResult.audio.bytesSent,getStatsResult.bandwidth.helper.videoBytesSent=getStatsResult.video.bytesSent),callback(getStatsResult),nomore||void 0!=typeof interval&&interval&&setTimeout(getStatsLooper,interval||1e3)})}function getStatsWrapper(cb){"undefined"!=typeof window.InstallTrigger?peer.getStats(mediaStreamTrack,function(res){var items=[];res.forEach(function(r){items.push(r)}),cb(items)},cb):peer.getStats(function(res){var items=[];res.result().forEach(function(res){var item={};res.names().forEach(function(name){item[name]=res.stat(name)}),item.id=res.id,item.type=res.type,item.timestamp=res.timestamp,items.push(item)}),cb(items)})}var RTCPeerConnection=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection;"undefined"==typeof MediaStreamTrack&&(MediaStreamTrack={});var systemNetworkType=((navigator.connection||{}).type||"unknown").toString().toLowerCase(),getStatsResult={encryption:"sha-256",audio:{send:{tracks:[],codecs:[],availableBandwidth:0,streams:0},recv:{tracks:[],codecs:[],availableBandwidth:0,streams:0},bytesSent:0,bytesReceived:0},video:{send:{tracks:[],codecs:[],availableBandwidth:0,streams:0},recv:{tracks:[],codecs:[],availableBandwidth:0,streams:0},bytesSent:0,bytesReceived:0},bandwidth:{systemBandwidth:0,sentPerSecond:0,encodedPerSecond:0,helper:{audioBytesSent:0,videoBytestSent:0},speed:0},results:{},connectionType:{systemNetworkType:systemNetworkType,systemIpAddress:"192.168.1.2",local:{candidateType:[],transport:[],ipAddress:[],networkType:[]},remote:{candidateType:[],transport:[],ipAddress:[],networkType:[]}},resolutions:{send:{width:0,height:0},recv:{width:0,height:0}},internal:{audio:{send:{},recv:{}},video:{send:{},recv:{}},candidates:{}},nomore:function(){nomore=!0}},getStatsParser={checkIfOfferer:function(result){"googLibjingleSession"===result.type&&(getStatsResult.isOfferer=result.googInitiator)}},peer=this;if(arguments[0]instanceof RTCPeerConnection){if(peer=arguments[0],navigator.mozGetUserMedia&&(mediaStreamTrack=arguments[1],callback=arguments[2],interval=arguments[3]),!(mediaStreamTrack instanceof MediaStreamTrack)&&navigator.mozGetUserMedia)throw"2nd argument is not instance of MediaStreamTrack."}else if(!(mediaStreamTrack instanceof MediaStreamTrack)&&navigator.mozGetUserMedia)throw"1st argument is not instance of MediaStreamTrack.";var nomore=!1;getStatsParser.datachannel=function(result){"datachannel"===result.type&&(getStatsResult.datachannel={state:result.state})},getStatsParser.googCertificate=function(result){"googCertificate"==result.type&&(getStatsResult.encryption=result.googFingerprintAlgorithm)};var AUDIO_codecs=["opus","isac","ilbc"];getStatsParser.checkAudioTracks=function(result){if(result.googCodecName&&"audio"===result.mediaType&&AUDIO_codecs.indexOf(result.googCodecName.toLowerCase())!==-1){var sendrecvType=result.id.split("_").pop();if(getStatsResult.audio[sendrecvType].codecs.indexOf(result.googCodecName)===-1&&getStatsResult.audio[sendrecvType].codecs.push(result.googCodecName),result.bytesSent){var kilobytes=0;if(result.bytesSent){getStatsResult.internal.audio[sendrecvType].prevBytesSent||(getStatsResult.internal.audio[sendrecvType].prevBytesSent=result.bytesSent);var bytes=result.bytesSent-getStatsResult.internal.audio[sendrecvType].prevBytesSent;getStatsResult.internal.audio[sendrecvType].prevBytesSent=result.bytesSent,kilobytes=bytes/1024}getStatsResult.audio[sendrecvType].availableBandwidth=kilobytes.toFixed(1)}if(result.bytesReceived){var kilobytes=0;if(result.bytesReceived){getStatsResult.internal.audio[sendrecvType].prevBytesReceived||(getStatsResult.internal.audio[sendrecvType].prevBytesReceived=result.bytesReceived);var bytes=result.bytesReceived-getStatsResult.internal.audio[sendrecvType].prevBytesReceived;getStatsResult.internal.audio[sendrecvType].prevBytesReceived=result.bytesReceived,kilobytes=bytes/1024}getStatsResult.audio[sendrecvType].availableBandwidth=kilobytes.toFixed(1)}getStatsResult.audio[sendrecvType].tracks.indexOf(result.googTrackId)===-1&&getStatsResult.audio[sendrecvType].tracks.push(result.googTrackId)}};var VIDEO_codecs=["vp9","vp8","h264"];getStatsParser.checkVideoTracks=function(result){if(result.googCodecName&&"video"===result.mediaType&&VIDEO_codecs.indexOf(result.googCodecName.toLowerCase())!==-1){var sendrecvType=result.id.split("_").pop();if(getStatsResult.video[sendrecvType].codecs.indexOf(result.googCodecName)===-1&&getStatsResult.video[sendrecvType].codecs.push(result.googCodecName),result.bytesSent){var kilobytes=0;getStatsResult.internal.video[sendrecvType].prevBytesSent||(getStatsResult.internal.video[sendrecvType].prevBytesSent=result.bytesSent);var bytes=result.bytesSent-getStatsResult.internal.video[sendrecvType].prevBytesSent;getStatsResult.internal.video[sendrecvType].prevBytesSent=result.bytesSent,kilobytes=bytes/1024}if(result.bytesReceived){var kilobytes=0;getStatsResult.internal.video[sendrecvType].prevBytesReceived||(getStatsResult.internal.video[sendrecvType].prevBytesReceived=result.bytesReceived);var bytes=result.bytesReceived-getStatsResult.internal.video[sendrecvType].prevBytesReceived;getStatsResult.internal.video[sendrecvType].prevBytesReceived=result.bytesReceived,kilobytes=bytes/1024}if(getStatsResult.video[sendrecvType].availableBandwidth=kilobytes.toFixed(1),result.packetsLost){var kilolostPackets=0;getStatsResult.internal.video[sendrecvType].prevLostPacket||(getStatsResult.internal.video[sendrecvType].prevLostPacket=result.packetsLost);var packets=result.packetsLost-getStatsResult.internal.video[sendrecvType].prevLostPacket;kilolostPackets=packets/1024,getStatsResult.video[sendrecvType].packetsLostRate=0!=kilobytes?100*(kilolostPackets/kilobytes).toFixed(4)+"%":"0.00%"}result.googFrameHeightReceived&&result.googFrameWidthReceived&&(getStatsResult.resolutions[sendrecvType].width=result.googFrameWidthReceived,getStatsResult.resolutions[sendrecvType].height=result.googFrameHeightReceived),result.googFrameHeightSent&&result.googFrameWidthSent&&(getStatsResult.resolutions[sendrecvType].width=result.googFrameWidthSent,getStatsResult.resolutions[sendrecvType].height=result.googFrameHeightSent),getStatsResult.video[sendrecvType].tracks.indexOf(result.googTrackId)===-1&&getStatsResult.video[sendrecvType].tracks.push(result.googTrackId)}},getStatsParser.bweforvideo=function(result){"VideoBwe"===result.type&&(getStatsResult.bandwidth.availableSendBandwidth=result.googAvailableSendBandwidth,getStatsResult.bandwidth.googActualEncBitrate=result.googActualEncBitrate,getStatsResult.bandwidth.googAvailableSendBandwidth=result.googAvailableSendBandwidth,getStatsResult.bandwidth.googAvailableReceiveBandwidth=result.googAvailableReceiveBandwidth,getStatsResult.bandwidth.googRetransmitBitrate=result.googRetransmitBitrate,getStatsResult.bandwidth.googTargetEncBitrate=result.googTargetEncBitrate,getStatsResult.bandwidth.googBucketDelay=result.googBucketDelay,getStatsResult.bandwidth.googTransmitBitrate=result.googTransmitBitrate)},getStatsParser.candidatePair=function(result){if("googCandidatePair"===result.type||"candidate-pair"===result.type){if("true"==result.googActiveConnection){Object.keys(getStatsResult.internal.candidates).forEach(function(cid){var candidate=getStatsResult.internal.candidates[cid];candidate.ipAddress.indexOf(result.googLocalAddress)!==-1&&(getStatsResult.connectionType.local.candidateType=candidate.candidateType,getStatsResult.connectionType.local.ipAddress=candidate.ipAddress,getStatsResult.connectionType.local.networkType=candidate.networkType,getStatsResult.connectionType.local.transport=candidate.transport),candidate.ipAddress.indexOf(result.googRemoteAddress)!==-1&&(getStatsResult.connectionType.remote.candidateType=candidate.candidateType,getStatsResult.connectionType.remote.ipAddress=candidate.ipAddress,getStatsResult.connectionType.remote.networkType=candidate.networkType,getStatsResult.connectionType.remote.transport=candidate.transport)}),getStatsResult.connectionType.transport=result.googTransportType;var localCandidate=getStatsResult.internal.candidates[result.localCandidateId];localCandidate&&localCandidate.ipAddress&&(getStatsResult.connectionType.systemIpAddress=localCandidate.ipAddress);var remoteCandidate=getStatsResult.internal.candidates[result.remoteCandidateId];remoteCandidate&&remoteCandidate.ipAddress&&(getStatsResult.connectionType.systemIpAddress=remoteCandidate.ipAddress)}if("candidate-pair"===result.type&&result.selected===!0&&result.nominated===!0&&"succeeded"===result.state)var localCandidate=getStatsResult.internal.candidates[result.remoteCandidateId],remoteCandidate=getStatsResult.internal.candidates[result.remoteCandidateId]}};var LOCAL_candidateType={},LOCAL_transport={},LOCAL_ipAddress={},LOCAL_networkType={};getStatsParser.localcandidate=function(result){"localcandidate"!==result.type&&"local-candidate"!==result.type||result.id&&(LOCAL_candidateType[result.id]||(LOCAL_candidateType[result.id]=[]),LOCAL_transport[result.id]||(LOCAL_transport[result.id]=[]),LOCAL_ipAddress[result.id]||(LOCAL_ipAddress[result.id]=[]),LOCAL_networkType[result.id]||(LOCAL_networkType[result.id]=[]),result.candidateType&&LOCAL_candidateType[result.id].indexOf(result.candidateType)===-1&&LOCAL_candidateType[result.id].push(result.candidateType),result.transport&&LOCAL_transport[result.id].indexOf(result.transport)===-1&&LOCAL_transport[result.id].push(result.transport),result.ipAddress&&LOCAL_ipAddress[result.id].indexOf(result.ipAddress+":"+result.portNumber)===-1&&LOCAL_ipAddress[result.id].push(result.ipAddress+":"+result.portNumber),result.networkType&&LOCAL_networkType[result.id].indexOf(result.networkType)===-1&&LOCAL_networkType[result.id].push(result.networkType),getStatsResult.internal.candidates[result.id]={candidateType:LOCAL_candidateType[result.id],ipAddress:LOCAL_ipAddress[result.id],portNumber:result.portNumber,networkType:LOCAL_networkType[result.id],priority:result.priority,transport:LOCAL_transport[result.id],timestamp:result.timestamp,id:result.id,type:result.type},getStatsResult.connectionType.local.candidateType=LOCAL_candidateType[result.id],getStatsResult.connectionType.local.ipAddress=LOCAL_ipAddress[result.id],getStatsResult.connectionType.local.networkType=LOCAL_networkType[result.id],getStatsResult.connectionType.local.transport=LOCAL_transport[result.id])};var REMOTE_candidateType={},REMOTE_transport={},REMOTE_ipAddress={},REMOTE_networkType={};getStatsParser.remotecandidate=function(result){"remotecandidate"!==result.type&&"remote-candidate"!==result.type||result.id&&(REMOTE_candidateType[result.id]||(REMOTE_candidateType[result.id]=[]),REMOTE_transport[result.id]||(REMOTE_transport[result.id]=[]),REMOTE_ipAddress[result.id]||(REMOTE_ipAddress[result.id]=[]),REMOTE_networkType[result.id]||(REMOTE_networkType[result.id]=[]),result.candidateType&&REMOTE_candidateType[result.id].indexOf(result.candidateType)===-1&&REMOTE_candidateType[result.id].push(result.candidateType),result.transport&&REMOTE_transport[result.id].indexOf(result.transport)===-1&&REMOTE_transport[result.id].push(result.transport),result.ipAddress&&REMOTE_ipAddress[result.id].indexOf(result.ipAddress+":"+result.portNumber)===-1&&REMOTE_ipAddress[result.id].push(result.ipAddress+":"+result.portNumber),result.networkType&&REMOTE_networkType[result.id].indexOf(result.networkType)===-1&&REMOTE_networkType[result.id].push(result.networkType),getStatsResult.internal.candidates[result.id]={candidateType:REMOTE_candidateType[result.id],ipAddress:REMOTE_ipAddress[result.id],portNumber:result.portNumber,networkType:REMOTE_networkType[result.id],priority:result.priority,transport:REMOTE_transport[result.id],timestamp:result.timestamp,id:result.id,type:result.type},getStatsResult.connectionType.remote.candidateType=REMOTE_candidateType[result.id],getStatsResult.connectionType.remote.ipAddress=REMOTE_ipAddress[result.id],getStatsResult.connectionType.remote.networkType=REMOTE_networkType[result.id],getStatsResult.connectionType.remote.transport=REMOTE_transport[result.id])},getStatsParser.dataSentReceived=function(result){!result.googCodecName||"video"!==result.mediaType&&"audio"!==result.mediaType||(result.bytesSent&&(getStatsResult[result.mediaType].bytesSent=parseInt(result.bytesSent)),result.bytesReceived&&(getStatsResult[result.mediaType].bytesReceived=parseInt(result.bytesReceived)))};var SSRC={audio:{send:[],recv:[]},video:{send:[],recv:[]}};getStatsParser.ssrc=function(result){if(result.googCodecName&&("video"===result.mediaType||"audio"===result.mediaType)&&"ssrc"===result.type){var sendrecvType=result.id.split("_").pop();SSRC[result.mediaType][sendrecvType].indexOf(result.ssrc)===-1&&SSRC[result.mediaType][sendrecvType].push(result.ssrc),getStatsResult[result.mediaType][sendrecvType].streams=SSRC[result.mediaType][sendrecvType].length}},getStatsLooper()}; \ No newline at end of file diff --git a/yarn-error.log b/yarn-error.log index cb50040..cecf050 100644 --- a/yarn-error.log +++ b/yarn-error.log @@ -1,5 +1,5 @@ Arguments: - /Users/Arthur/.nvm/versions/node/v10.6.0/bin/node /Users/Arthur/.yarn/bin/yarn.js git@github.com:orangebook/getStats.git + /Users/Arthur/.nvm/versions/node/v10.6.0/bin/node /Users/Arthur/.yarn/bin/yarn.js upload:staging PATH: /Users/Arthur/.yarn/bin:/Users/Arthur/.config/yarn/global/node_modules/.bin:/Users/Arthur/SysProj/depot_tools:/Users/Arthur/Library/Android/sdk/platform-tools:/Users/Arthur/Library/Android/sdk/tools:/usr/local/Cellar/ninja/1.8.2/bin:/usr/local/opt/llvm/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/Arthur/.yarn/bin:/Users/Arthur/.config/yarn/global/node_modules/.bin:/Users/Arthur/SysProj/depot_tools:/Users/Arthur/Library/Android/sdk/platform-tools:/Users/Arthur/Library/Android/sdk/tools:/usr/local/Cellar/ninja/1.8.2/bin:/usr/local/opt/llvm/bin:/Users/Arthur/.nvm/versions/node/v10.6.0/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/Arthur/.go_pkg:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/usr/local/opt/go/libexec/bin:/Users/Arthur/.go_pkg:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/usr/local/opt/go/libexec/bin @@ -71,7 +71,7 @@ Lockfile: No lockfile Trace: - Error: Command "git@github.com:orangebook/getStats.git" not found. + Error: Command "upload:staging" not found. at new MessageError (/Users/Arthur/.yarn/lib/cli.js:186:110) at /Users/Arthur/.yarn/lib/cli.js:87307:17 at Generator.next ()