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 var rtpStream
= chrome
.cast
.streaming
.rtpStream
;
6 var tabCapture
= chrome
.tabCapture
;
7 var udpTransport
= chrome
.cast
.streaming
.udpTransport
;
8 var createSession
= chrome
.cast
.streaming
.session
.create
;
9 var pass
= chrome
.test
.callbackPass
;
11 chrome
.test
.runTests([
12 function rtpStreamStart() {
13 console
.log("[TEST] rtpStreamStart");
14 tabCapture
.capture({audio
: true, video
: true},
15 pass(function(stream
) {
16 console
.log("Got MediaStream.");
17 chrome
.test
.assertTrue(!!stream
);
18 createSession(stream
.getAudioTracks()[0],
19 stream
.getVideoTracks()[0],
20 pass(function(stream
, audioId
, videoId
, udpId
) {
21 console
.log("Starting.");
22 var stateMachine
= new TestStateMachine(stream
,
26 var audioParams
= rtpStream
.getSupportedParams(audioId
)[0];
27 chrome
.test
.assertTrue(!!audioParams
.payload
.codecName
);
28 var expectError = function(id
, message
) {
29 chrome
.test
.assertEq("Destination not set.", message
);
30 chrome
.test
.succeed();
32 console
.log("Starting RTP stream before setting destination.");
33 rtpStream
.onError
.addListener(expectError
);
34 rtpStream
.start(audioId
, audioParams
);
35 }.bind(null, stream
)));