Chromium Code Reviews| 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 rtpStream = chrome.cast.streaming.rtpStream; | 5 var rtpStream = chrome.cast.streaming.rtpStream; |
| 6 var tabCapture = chrome.tabCapture; | 6 var tabCapture = chrome.tabCapture; |
| 7 var udpTransport = chrome.cast.streaming.udpTransport; | 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 rtpStreamStart() { | 11 function rtpStreamStart() { |
| 12 console.log("[TEST] rtpStreamStart"); | |
|
not at google - send to devlin
2013/12/27 10:35:22
this should happen automatically?
Alpha Left Google
2013/12/27 21:57:07
I didn't see that in the log. Only [SUCCESS]***.
not at google - send to devlin
2013/12/27 22:56:58
Ah ok you're right, there is no logging, sorry. Wh
| |
| 12 tabCapture.capture({audio: true, video: true}, function(stream) { | 13 tabCapture.capture({audio: true, video: true}, function(stream) { |
| 13 console.log("Got MediaStream."); | 14 console.log("Got MediaStream."); |
| 14 chrome.test.assertTrue(!!stream); | 15 chrome.test.assertTrue(!!stream); |
| 15 createSession(stream.getAudioTracks()[0], | 16 createSession(stream.getAudioTracks()[0], |
| 16 stream.getVideoTracks()[0], | 17 stream.getVideoTracks()[0], |
| 17 function(stream, audioId, videoId, udpId) { | 18 function(stream, audioId, videoId, udpId) { |
| 18 console.log("Starting."); | 19 console.log("Starting."); |
| 19 var audioParams = rtpStream.getCaps(audioId); | 20 var audioParams = rtpStream.getCaps(audioId); |
| 20 var videoParams = rtpStream.getCaps(videoId); | 21 var videoParams = rtpStream.getCaps(videoId); |
| 21 rtpStream.start(audioId, audioParams); | 22 rtpStream.start(audioId, audioParams); |
| 22 rtpStream.start(videoId, videoParams); | 23 rtpStream.start(videoId, videoParams); |
| 23 udpTransport.start(udpId, {address: "127.0.0.1", port: 2344}); | 24 udpTransport.start(udpId, {address: "127.0.0.1", port: 2344}); |
| 24 window.setTimeout(function() { | 25 window.setTimeout(function() { |
| 25 console.log("Stopping."); | 26 console.log("Stopping."); |
| 26 rtpStream.stop(audioId); | 27 rtpStream.stop(audioId); |
| 27 rtpStream.stop(videoId); | 28 rtpStream.stop(videoId); |
| 28 rtpStream.destroy(audioId); | 29 rtpStream.destroy(audioId); |
| 29 rtpStream.destroy(videoId); | 30 rtpStream.destroy(videoId); |
| 30 udpTransport.destroy(udpId); | 31 udpTransport.destroy(udpId); |
| 31 stream.stop(); | 32 stream.stop(); |
| 32 chrome.test.assertEq(audioParams.payloads[0].codecName, "OPUS"); | 33 chrome.test.assertEq(audioParams.payloads[0].codecName, "OPUS"); |
| 33 chrome.test.assertEq(videoParams.payloads[0].codecName, "VP8"); | 34 chrome.test.assertEq(videoParams.payloads[0].codecName, "VP8"); |
| 34 chrome.test.succeed(); | 35 chrome.test.succeed(); |
| 35 }, 0); | 36 }, 0); |
| 36 }.bind(null, stream)); | 37 }.bind(null, stream)); |
| 37 }); | 38 }); |
| 38 }, | 39 }, |
| 40 function invalidKey() { | |
| 41 console.log("[TEST] invalidKey"); | |
|
not at google - send to devlin
2013/12/27 10:35:22
ditto. is something not working?
Alpha Left Google
2013/12/27 21:57:07
Same here I couldn't see the message when a start
| |
| 42 tabCapture.capture({audio: true, video: true}, function(stream) { | |
|
not at google - send to devlin
2013/12/27 10:35:22
you should probably be wrapping all callbacks (her
Alpha Left Google
2013/12/27 21:57:07
Done.
| |
| 43 chrome.test.assertTrue(!!stream); | |
| 44 createSession(stream.getAudioTracks()[0], | |
| 45 stream.getVideoTracks()[0], | |
| 46 function(stream, audioId, videoId, udpId) { | |
| 47 try { | |
| 48 var audioParams = rtpStream.getCaps(audioId); | |
| 49 var videoParams = rtpStream.getCaps(videoId); | |
| 50 audioParams.payloads[0].aes_key = "google"; | |
| 51 videoParams.payloads[0].aes_iv_mask = "chrome"; | |
| 52 rtpStream.start(audioId, audioParams); | |
| 53 rtpStream.start(videoId, videoParams); | |
|
not at google - send to devlin
2013/12/27 10:35:22
need a comment somewhere around here indicating wh
Alpha Left Google
2013/12/27 21:57:07
Done.
I'll probably punt having the correct AES k
| |
| 54 } catch (e) { | |
| 55 rtpStream.destroy(audioId); | |
| 56 rtpStream.destroy(videoId); | |
| 57 udpTransport.destroy(udpId); | |
| 58 stream.stop(); | |
| 59 chrome.test.succeed(); | |
| 60 } | |
| 61 }.bind(null, stream)); | |
| 62 }); | |
| 63 }, | |
| 39 ]); | 64 ]); |
| OLD | NEW |