OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var sendTransport = chrome.webrtc.castSendTransport; | 5 var rtpStream = chrome.cast.streaming.rtpStream; |
6 var tabCapture = chrome.tabCapture; | 6 var tabCapture = chrome.tabCapture; |
7 var udpTransport = chrome.webrtc.castUdpTransport; | 7 var udpTransport = chrome.cast.streaming.udpTransport; |
8 var createSession = chrome.cast.streaming.session.create; | 8 var createSession = chrome.cast.streaming.session.create; |
9 | 9 |
10 chrome.test.runTests([ | 10 chrome.test.runTests([ |
11 function sendTransportStart() { | 11 function rtpStreamStart() { |
12 tabCapture.capture({audio: true, video: true}, function(stream) { | 12 tabCapture.capture({audio: true, video: true}, function(stream) { |
13 console.log("Got MediaStream."); | 13 console.log("Got MediaStream."); |
14 chrome.test.assertTrue(!!stream); | 14 chrome.test.assertTrue(!!stream); |
15 createSession(stream.getAudioTracks()[0], | 15 createSession(stream.getAudioTracks()[0], |
16 stream.getVideoTracks()[0], | 16 stream.getVideoTracks()[0], |
17 function(stream, audioId, videoId, udpId) { | 17 function(stream, audioId, videoId, udpId) { |
18 var audioParams = sendTransport.getCaps(audioId); | 18 var audioParams = rtpStream.getCaps(audioId); |
19 var videoParams = sendTransport.getCaps(videoId); | 19 var videoParams = rtpStream.getCaps(videoId); |
20 sendTransport.start(audioId, audioParams); | 20 rtpStream.start(audioId, audioParams); |
21 sendTransport.start(videoId, videoParams); | 21 rtpStream.start(videoId, videoParams); |
22 sendTransport.stop(audioId); | 22 rtpStream.stop(audioId); |
23 sendTransport.stop(videoId); | 23 rtpStream.stop(videoId); |
24 sendTransport.destroy(audioId); | 24 rtpStream.destroy(audioId); |
25 sendTransport.destroy(videoId); | 25 rtpStream.destroy(videoId); |
26 udpTransport.destroy(udpId); | 26 udpTransport.destroy(udpId); |
27 stream.stop(); | 27 stream.stop(); |
28 chrome.test.assertEq(audioParams.payloads[0].codecName, "OPUS"); | 28 chrome.test.assertEq(audioParams.payloads[0].codecName, "OPUS"); |
29 chrome.test.assertEq(videoParams.payloads[0].codecName, "VP8"); | 29 chrome.test.assertEq(videoParams.payloads[0].codecName, "VP8"); |
30 chrome.test.succeed(); | 30 chrome.test.succeed(); |
31 }.bind(null, stream)); | 31 }.bind(null, stream)); |
32 }); | 32 }); |
33 }, | 33 }, |
34 ]); | 34 ]); |
OLD | NEW |