webrtc-troubleshoot
Advanced tools
Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "webrtc-troubleshooter", | ||
"version": "1.0.7", | ||
"version": "2.0.1", | ||
"description": "A way to add webrtc troubleshooting to your app", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
{ | ||
"name": "webrtc-troubleshoot", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A way to add webrtc troubleshooting to your app", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
"babelify": "^7.2.0", | ||
"browserify": "^13.0.1", | ||
"browserify": "^13.3.0", | ||
"uglify-js": "^2.7.3" | ||
@@ -23,0 +23,0 @@ }, |
@@ -40,2 +40,5 @@ // adapted from https://github.com/webrtc/testrtc/blob/master/src/js/bandwidth_test.js | ||
} | ||
this.providedStream = this.options.screenStream; | ||
this.log = []; | ||
@@ -61,10 +64,21 @@ this.stats = {}; | ||
return this.doGetUserMedia(this.constraints).then(() => { | ||
let promise; | ||
if (this.providedStream) { | ||
promise = this.gotStream(this.providedStream); | ||
} else { | ||
promise = this.doGetUserMedia(this.constraints); | ||
} | ||
return promise.then(() => { | ||
const results = this.getResults(); | ||
if (!this.hasError) { | ||
return this.resolve(this.getResults()); | ||
return this.resolve(results); | ||
} else { | ||
return this.reject(new Error('Video Bandwidth Error'), this.getResults()); | ||
results.error = new Error('Video Bandwidth Error'); | ||
return this.reject(results); | ||
} | ||
}, (err) => { | ||
return this.reject(err, this.getResults()); | ||
const results = this.getResults(); | ||
results.error = err; | ||
return this.reject(err); | ||
}); | ||
@@ -74,3 +88,3 @@ } | ||
getResults () { | ||
const results = { | ||
return { | ||
log: this.log, | ||
@@ -80,3 +94,2 @@ stats: this.stats, | ||
}; | ||
return results; | ||
} | ||
@@ -160,2 +173,3 @@ | ||
this.packetsLost = report['packetsLost']; | ||
this.packetsSent = report['packetsSent']; | ||
} | ||
@@ -166,3 +180,3 @@ }); | ||
let stats = response[j]; | ||
if (stats.id === 'outbound_rtcp_video_0') { | ||
if (stats.id.startsWith('outbound_rtcp_video_')) { | ||
this.rttStats.add(Date.parse(stats.timestamp), parseInt(stats.mozRtt, 10)); | ||
@@ -172,3 +186,3 @@ // Grab the last stats. | ||
this.packetsLost = stats.packetsLost; | ||
} else if (stats.id === 'outbound_rtp_video_0') { | ||
} else if (stats.id.startsWith('outbound_rtp_video_')) { | ||
// TODO: Get dimensions from getStats when supported in FF. | ||
@@ -179,2 +193,3 @@ this.videoStats[0] = 'Not supported on Firefox'; | ||
this.bitrateStdDev = stats.bitrateStdDev; | ||
this.packetsSent = stats.packetsSent; | ||
this.framerateMean = stats.framerateMean; | ||
@@ -208,9 +223,9 @@ } | ||
stats.resolution = `${this.videoStats[0]}x${this.videoStats[1]}`; | ||
stats.bpsAvg = this.bweStats.getAverage(); | ||
stats.bpsMax = this.bweStats.getMax(); | ||
stats.mbpsAvg = this.bweStats.getAverage() / 1000; | ||
stats.mbpsMax = this.bweStats.getMax() / 1000; | ||
stats.rampUpTimeMs = this.bweStats.getRampUpTime(); | ||
this.addLog('info', `Video resolution: ${stats.resolution}`); | ||
this.addLog('info', `Send bandwidth estimate average: ${stats.bpsAvg} bps`); | ||
this.addLog('info', `Send bandwidth estimate max: ${stats.bpsMax} bps`); | ||
this.addLog('info', `Send bandwidth estimate average: ${stats.mbpsAvg} mpbs`); | ||
this.addLog('info', `Send bandwidth estimate max: ${stats.mbpsMax} mbps`); | ||
this.addLog('info', `Send bandwidth ramp-up time: ${stats.rampUpTimeMs} ms`); | ||
@@ -220,3 +235,3 @@ } | ||
if (parseInt(this.framerateMean, 10) > 0) { | ||
this.addLog('SUCCESS', `Frame rate mean: ${parseInt(this.framerateMean, 10)}`); | ||
this.addLog('info', `Frame rate mean: ${parseInt(this.framerateMean, 10)}`); | ||
} else { | ||
@@ -227,11 +242,14 @@ this.addLog('error', 'Frame rate mean is 0, cannot test bandwidth without a working camera.'); | ||
stats.bitrateMean = this.bitrateMean; | ||
stats.bitrateStdDev = this.bitrateStdDev; | ||
this.addLog('info', `Send bitrate mean: ${stats.bitrateMean} bps`); | ||
this.addLog('info', `Send bitrate standard deviation: ${stats.bitrateStdDev} bps`); | ||
stats.mbpsAvg = this.bitrateMean / 1000; | ||
stats.mbpsStdDev = this.bitrateStdDev / 1000; | ||
this.addLog('info', `Send bitrate mean: ${stats.mbpsAvg} mbps`); | ||
this.addLog('info', `Send bitrate standard deviation: ${stats.mbpsStdDev} mbps`); | ||
} | ||
stats.rttAverage = this.rttStats.getAverage(); | ||
stats.rttMax = this.rttStats.getMax(); | ||
stats.lostPackets = parseInt(this.packetsLost, 10); | ||
if (this.packetsSent) { | ||
stats.packetLoss = parseInt(this.packetsLost, 10) / parseFloat(this.packetsSent); | ||
} | ||
this.addLog('info', `RTT average: ${stats.rttAverage} ms`); | ||
@@ -238,0 +256,0 @@ this.addLog('info', `RTT max: ${stats.rttMax} ms`); |
@@ -16,4 +16,4 @@ export default class Test { | ||
resolve () { | ||
this.deferred.resolve(); | ||
resolve (data) { | ||
this.deferred.resolve(data); | ||
return this.promise; | ||
@@ -20,0 +20,0 @@ } |
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
285004
2154
9
1