-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getStats.js updated. Now returning arrays instead of strings.
alert(result.connectionType.remote.networkType instanceof Arrray); bytesSent/bytesReceived fixed: result.audio.bytesSent result.video.bytesSent
- Loading branch information
Showing
12 changed files
with
328 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
getStatsParser.dataSentReceived = function(result) { | ||
var mediaType = result.googCodecName !== 'opus' ? 'video' : 'audio'; | ||
if (!result.googCodecName || (result.mediaType !== 'video' && result.mediaType !== 'audio')) return; | ||
|
||
if (!!result.bytesSent) { | ||
getStatsResult[mediaType].bytesSent += parseInt(result.bytesSent); | ||
getStatsResult[result.mediaType].bytesSent = parseInt(result.bytesSent); | ||
} | ||
|
||
if (!!result.bytesReceived) { | ||
getStatsResult[mediaType].bytesReceived += parseInt(result.bytesReceived); | ||
getStatsResult[result.mediaType].bytesReceived = parseInt(result.bytesReceived); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,41 @@ | ||
var LOCAL_candidateType = []; | ||
var LOCAL_transport = []; | ||
var LOCAL_ipAddress = []; | ||
var LOCAL_networkType = []; | ||
|
||
getStatsParser.localcandidate = function(result) { | ||
if (result.type !== 'localcandidate') return; | ||
|
||
if (result.candidateType && LOCAL_candidateType.indexOf(result.candidateType) === -1) { | ||
LOCAL_candidateType.push(result.candidateType); | ||
} | ||
|
||
if (result.transport && LOCAL_transport.indexOf(result.transport) === -1) { | ||
LOCAL_transport.push(result.transport); | ||
} | ||
|
||
if (result.ipAddress && LOCAL_ipAddress.indexOf(result.ipAddress + ':' + result.portNumber) === -1) { | ||
LOCAL_ipAddress.push(result.ipAddress + ':' + result.portNumber); | ||
} | ||
|
||
if (result.networkType && LOCAL_networkType.indexOf(result.networkType) === -1) { | ||
LOCAL_networkType.push(result.networkType); | ||
} | ||
|
||
getStatsResult.internal.candidates[result.id] = { | ||
candidateType: result.candidateType, | ||
ipAddress: result.ipAddress /* + ':' + result.portNumber */ , | ||
candidateType: LOCAL_candidateType, | ||
ipAddress: LOCAL_ipAddress, | ||
portNumber: result.portNumber, | ||
networkType: result.networkType, | ||
networkType: LOCAL_networkType, | ||
priority: result.priority, | ||
transport: result.transport, | ||
transport: LOCAL_transport, | ||
timestamp: result.timestamp, | ||
id: result.id, | ||
type: result.type | ||
}; | ||
|
||
getStatsResult.connectionType.local.candidateType = result.candidateType; | ||
getStatsResult.connectionType.local.ipAddress = result.ipAddress + ':' + result.portNumber; | ||
getStatsResult.connectionType.local.networkType = getStatsResult.connectionType.local.networkType || result.networkType || systemNetworkType; | ||
getStatsResult.connectionType.local.transport = result.transport; | ||
getStatsResult.connectionType.local.candidateType = LOCAL_candidateType; | ||
getStatsResult.connectionType.local.ipAddress = LOCAL_ipAddress; | ||
getStatsResult.connectionType.local.networkType = LOCAL_networkType; | ||
getStatsResult.connectionType.local.transport = LOCAL_transport; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,41 @@ | ||
var REMOTE_candidateType = []; | ||
var REMOTE_transport = []; | ||
var REMOTE_ipAddress = []; | ||
var REMOTE_networkType = []; | ||
|
||
getStatsParser.remotecandidate = function(result) { | ||
if (result.type !== 'remotecandidate') return; | ||
|
||
if (result.candidateType && REMOTE_candidateType.indexOf(result.candidateType) === -1) { | ||
REMOTE_candidateType.push(result.candidateType); | ||
} | ||
|
||
if (result.transport && REMOTE_transport.indexOf(result.transport) === -1) { | ||
REMOTE_transport.push(result.transport); | ||
} | ||
|
||
if (result.ipAddress && REMOTE_ipAddress.indexOf(result.ipAddress + ':' + result.portNumber) === -1) { | ||
REMOTE_ipAddress.push(result.ipAddress + ':' + result.portNumber); | ||
} | ||
|
||
if (result.networkType && REMOTE_networkType.indexOf(result.networkType) === -1) { | ||
REMOTE_networkType.push(result.networkType); | ||
} | ||
|
||
getStatsResult.internal.candidates[result.id] = { | ||
candidateType: result.candidateType, | ||
ipAddress: result.ipAddress /* + ':' + result.portNumber */ , | ||
candidateType: REMOTE_candidateType, | ||
ipAddress: REMOTE_ipAddress, | ||
portNumber: result.portNumber, | ||
networkType: result.networkType, | ||
networkType: REMOTE_networkType, | ||
priority: result.priority, | ||
transport: result.transport, | ||
transport: REMOTE_transport, | ||
timestamp: result.timestamp, | ||
id: result.id, | ||
type: result.type | ||
}; | ||
|
||
getStatsResult.connectionType.remote.candidateType = result.candidateType; | ||
getStatsResult.connectionType.remote.ipAddress = result.ipAddress + ':' + result.portNumber; | ||
getStatsResult.connectionType.remote.networkType = getStatsResult.connectionType.remote.networkType || result.networkType || systemNetworkType; | ||
getStatsResult.connectionType.remote.transport = result.transport; | ||
getStatsResult.connectionType.remote.candidateType = REMOTE_candidateType; | ||
getStatsResult.connectionType.remote.ipAddress = REMOTE_ipAddress; | ||
getStatsResult.connectionType.remote.networkType = REMOTE_networkType; | ||
getStatsResult.connectionType.remote.transport = REMOTE_transport; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var SSRC = { | ||
audio: { | ||
send: [], | ||
recv: [] | ||
}, | ||
video: { | ||
send: [], | ||
recv: [] | ||
} | ||
}; | ||
|
||
getStatsParser.ssrc = function(result) { | ||
if (!result.googCodecName || (result.mediaType !== 'video' && result.mediaType !== 'audio')) return; | ||
if (result.type !== 'ssrc') return; | ||
var sendrecvType = result.id.split('_').pop(); | ||
|
||
if (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; | ||
}; |
Oops, something went wrong.