1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Run a cast v2 mirroring session for 10 seconds.
8 function sendTestPatterns() {
9 // The receive port changes between browser_test invocations, and is passed
10 // as an query parameter in the URL.
13 recvPort
= parseInt(window
.location
.search
.substring("?port=".length
));
14 chrome
.test
.assertTrue(recvPort
> 0);
16 chrome
.test
.fail("Error parsing ?port=### -- " + err
.message
);
24 chrome
.tabCapture
.capture(
33 maxFrameRate
: frameRate
,
37 function startStreamingTestPatterns(captureStream
) {
38 chrome
.test
.assertTrue(!!captureStream
);
39 chrome
.cast
.streaming
.session
.create(
40 captureStream
.getAudioTracks()[0],
41 captureStream
.getVideoTracks()[0],
42 function (audioId
, videoId
, udpId
) {
43 chrome
.cast
.streaming
.udpTransport
.setDestination(
44 udpId
, { address
: "127.0.0.1", port
: recvPort
} );
45 var rtpStream
= chrome
.cast
.streaming
.rtpStream
;
46 rtpStream
.start(audioId
,
47 rtpStream
.getSupportedParams(audioId
)[0]);
48 var videoParams
= rtpStream
.getSupportedParams(videoId
)[0];
49 videoParams
.payload
.clockRate
= frameRate
;
50 rtpStream
.start(videoId
, videoParams
);
51 setTimeout(function () {
52 chrome
.test
.succeed();
53 rtpStream
.stop(audioId
);
54 rtpStream
.stop(videoId
);
55 }, 20000); // 20 seconds