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">
|
||||
<p>Duration (s): <input id="duration" 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><input id="launcher-button" type="button" value="Run test">
|
||||
<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 autoModeInput = document.createElement('input');
|
||||
var testStatus = document.getElementById('test-status');
|
||||
var pcConstraintsInput = document.getElementById('pc-constraints');
|
||||
|
||||
launcherButton.onclick = start;
|
||||
|
||||
@ -77,6 +79,7 @@ durationInput.value = getURLParameter('duration', 10);
|
||||
maxVideoBitrateInput.value = getURLParameter('max-video-bitrate', 2000);
|
||||
forceTurnInput.checked = (getURLParameter('force-turn', 'true') === 'true');
|
||||
autoModeInput.checked = (getURLParameter('auto-mode', 'false') === 'true');
|
||||
pcConstraintsInput.value = getURLParameter('pc-constraints', '');
|
||||
|
||||
if (autoModeInput.checked) start();
|
||||
|
||||
@ -85,6 +88,7 @@ function start() {
|
||||
var maxVideoBitrateKbps = parseInt(maxVideoBitrateInput.value);
|
||||
var forceTurn = forceTurnInput.checked;
|
||||
var autoClose = autoModeInput.checked;
|
||||
var pcConstraints = JSON.parse(pcConstraintsInput.value);
|
||||
|
||||
var updateStatusInterval;
|
||||
var testFinished = false;
|
||||
@ -126,7 +130,9 @@ function start() {
|
||||
|
||||
function gotStream(stream) {
|
||||
updateStatus();
|
||||
var test = new LoopbackTest(stream, durationMs, forceTurn,
|
||||
var test = new LoopbackTest(stream, durationMs,
|
||||
forceTurn,
|
||||
pcConstraints,
|
||||
maxVideoBitrateKbps);
|
||||
test.run(onTestFinished.bind(test));
|
||||
}
|
||||
|
@ -15,13 +15,20 @@
|
||||
//
|
||||
// Usage:
|
||||
// var test = new LoopbackTest(stream, callDurationMs,
|
||||
// forceTurn, maxVideoBitrateKbps);
|
||||
// forceTurn, pcConstraints,
|
||||
// maxVideoBitrateKbps);
|
||||
// test.run(onDone);
|
||||
// function onDone() {
|
||||
// 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 pc2StatTracker;
|
||||
|
||||
@ -87,7 +94,7 @@ function LoopbackTest(stream, callDurationMs, forceTurn, maxVideoBitrateKbps) {
|
||||
function start(turnServer) {
|
||||
var pcConfig = forceTurn ? { iceServers: [turnServer] } : null;
|
||||
console.log(pcConfig);
|
||||
var pc1 = new RTCPeerConnection(pcConfig);
|
||||
var pc1 = new RTCPeerConnection(pcConfig, pcConstraints);
|
||||
constrainTurnCandidates(pc1);
|
||||
constrainOfferToRemoveFec(pc1);
|
||||
pc1StatTracker = new StatTracker(pc1, 50);
|
||||
@ -100,7 +107,7 @@ function LoopbackTest(stream, callDurationMs, forceTurn, maxVideoBitrateKbps) {
|
||||
pc1StatTracker.recordStat("ActualEncodedBitrate",
|
||||
"bweforvideo", "googActualEncBitrate");
|
||||
|
||||
var pc2 = new RTCPeerConnection(pcConfig);
|
||||
var pc2 = new RTCPeerConnection(pcConfig, pcConstraints);
|
||||
constrainTurnCandidates(pc2);
|
||||
constrainBitrateAnswer(pc2);
|
||||
pc2StatTracker = new StatTracker(pc2, 50);
|
||||
|
Loading…
x
Reference in New Issue
Block a user