Add ability to control peer connection constraints for the loopback test.
R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/11419005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5879 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
15192f909e
commit
0273fa98e0
@ -40,6 +40,7 @@
|
|||||||
<div id="test-launcher">
|
<div id="test-launcher">
|
||||||
<p>Duration (s): <input id="duration" type="text"></p>
|
<p>Duration (s): <input id="duration" type="text"></p>
|
||||||
<p>Max video bitrate (kbps): <input id="max-video-bitrate" type="text"></p>
|
<p>Max video bitrate (kbps): <input id="max-video-bitrate" type="text"></p>
|
||||||
|
<p>Peer connection constraints: <input id="pc-constraints" type="text"></p>
|
||||||
<p>Force TURN: <input id="force-turn" type="checkbox" checked></p>
|
<p>Force TURN: <input id="force-turn" type="checkbox" checked></p>
|
||||||
<p><input id="launcher-button" type="button" value="Run test">
|
<p><input id="launcher-button" type="button" value="Run test">
|
||||||
<div id="test-status" style="display:none"></div>
|
<div id="test-status" style="display:none"></div>
|
||||||
@ -58,6 +59,7 @@ var forceTurnInput = document.getElementById('force-turn');
|
|||||||
var launcherButton = document.getElementById('launcher-button');
|
var launcherButton = document.getElementById('launcher-button');
|
||||||
var autoModeInput = document.createElement('input');
|
var autoModeInput = document.createElement('input');
|
||||||
var testStatus = document.getElementById('test-status');
|
var testStatus = document.getElementById('test-status');
|
||||||
|
var pcConstraintsInput = document.getElementById('pc-constraints');
|
||||||
|
|
||||||
launcherButton.onclick = start;
|
launcherButton.onclick = start;
|
||||||
|
|
||||||
@ -77,6 +79,7 @@ durationInput.value = getURLParameter('duration', 10);
|
|||||||
maxVideoBitrateInput.value = getURLParameter('max-video-bitrate', 2000);
|
maxVideoBitrateInput.value = getURLParameter('max-video-bitrate', 2000);
|
||||||
forceTurnInput.checked = (getURLParameter('force-turn', 'true') === 'true');
|
forceTurnInput.checked = (getURLParameter('force-turn', 'true') === 'true');
|
||||||
autoModeInput.checked = (getURLParameter('auto-mode', 'false') === 'true');
|
autoModeInput.checked = (getURLParameter('auto-mode', 'false') === 'true');
|
||||||
|
pcConstraintsInput.value = getURLParameter('pc-constraints', '');
|
||||||
|
|
||||||
if (autoModeInput.checked) start();
|
if (autoModeInput.checked) start();
|
||||||
|
|
||||||
@ -85,6 +88,7 @@ function start() {
|
|||||||
var maxVideoBitrateKbps = parseInt(maxVideoBitrateInput.value);
|
var maxVideoBitrateKbps = parseInt(maxVideoBitrateInput.value);
|
||||||
var forceTurn = forceTurnInput.checked;
|
var forceTurn = forceTurnInput.checked;
|
||||||
var autoClose = autoModeInput.checked;
|
var autoClose = autoModeInput.checked;
|
||||||
|
var pcConstraints = JSON.parse(pcConstraintsInput.value);
|
||||||
|
|
||||||
var updateStatusInterval;
|
var updateStatusInterval;
|
||||||
var testFinished = false;
|
var testFinished = false;
|
||||||
@ -126,7 +130,9 @@ function start() {
|
|||||||
|
|
||||||
function gotStream(stream) {
|
function gotStream(stream) {
|
||||||
updateStatus();
|
updateStatus();
|
||||||
var test = new LoopbackTest(stream, durationMs, forceTurn,
|
var test = new LoopbackTest(stream, durationMs,
|
||||||
|
forceTurn,
|
||||||
|
pcConstraints,
|
||||||
maxVideoBitrateKbps);
|
maxVideoBitrateKbps);
|
||||||
test.run(onTestFinished.bind(test));
|
test.run(onTestFinished.bind(test));
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,20 @@
|
|||||||
//
|
//
|
||||||
// Usage:
|
// Usage:
|
||||||
// var test = new LoopbackTest(stream, callDurationMs,
|
// var test = new LoopbackTest(stream, callDurationMs,
|
||||||
// forceTurn, maxVideoBitrateKbps);
|
// forceTurn, pcConstraints,
|
||||||
|
// maxVideoBitrateKbps);
|
||||||
// test.run(onDone);
|
// test.run(onDone);
|
||||||
// function onDone() {
|
// function onDone() {
|
||||||
// test.getResults(); // return stats recorded during the loopback test.
|
// test.getResults(); // return stats recorded during the loopback test.
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
function LoopbackTest(stream, callDurationMs, forceTurn, maxVideoBitrateKbps) {
|
function LoopbackTest(
|
||||||
|
stream,
|
||||||
|
callDurationMs,
|
||||||
|
forceTurn,
|
||||||
|
pcConstraints,
|
||||||
|
maxVideoBitrateKbps) {
|
||||||
|
|
||||||
var pc1StatTracker;
|
var pc1StatTracker;
|
||||||
var pc2StatTracker;
|
var pc2StatTracker;
|
||||||
|
|
||||||
@ -87,7 +94,7 @@ function LoopbackTest(stream, callDurationMs, forceTurn, maxVideoBitrateKbps) {
|
|||||||
function start(turnServer) {
|
function start(turnServer) {
|
||||||
var pcConfig = forceTurn ? { iceServers: [turnServer] } : null;
|
var pcConfig = forceTurn ? { iceServers: [turnServer] } : null;
|
||||||
console.log(pcConfig);
|
console.log(pcConfig);
|
||||||
var pc1 = new RTCPeerConnection(pcConfig);
|
var pc1 = new RTCPeerConnection(pcConfig, pcConstraints);
|
||||||
constrainTurnCandidates(pc1);
|
constrainTurnCandidates(pc1);
|
||||||
constrainOfferToRemoveFec(pc1);
|
constrainOfferToRemoveFec(pc1);
|
||||||
pc1StatTracker = new StatTracker(pc1, 50);
|
pc1StatTracker = new StatTracker(pc1, 50);
|
||||||
@ -100,7 +107,7 @@ function LoopbackTest(stream, callDurationMs, forceTurn, maxVideoBitrateKbps) {
|
|||||||
pc1StatTracker.recordStat("ActualEncodedBitrate",
|
pc1StatTracker.recordStat("ActualEncodedBitrate",
|
||||||
"bweforvideo", "googActualEncBitrate");
|
"bweforvideo", "googActualEncBitrate");
|
||||||
|
|
||||||
var pc2 = new RTCPeerConnection(pcConfig);
|
var pc2 = new RTCPeerConnection(pcConfig, pcConstraints);
|
||||||
constrainTurnCandidates(pc2);
|
constrainTurnCandidates(pc2);
|
||||||
constrainBitrateAnswer(pc2);
|
constrainBitrateAnswer(pc2);
|
||||||
pc2StatTracker = new StatTracker(pc2, 50);
|
pc2StatTracker = new StatTracker(pc2, 50);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user