Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: content/test/data/media/peerconnection-call.html

Issue 117843002: Enable some webrtc content_browsertests on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reload Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/media/webrtc_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script>
4 <script type="text/javascript" src="webrtc_test_audio.js"></script> 4 <script type="text/javascript" src="webrtc_test_audio.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 $ = function(id) { 6 $ = function(id) {
7 return document.getElementById(id); 7 return document.getElementById(id);
8 }; 8 };
9 9
10 var gFirstConnection = null; 10 var gFirstConnection = null;
11 var gSecondConnection = null; 11 var gSecondConnection = null;
12 var gTestWithoutMsid = false; 12 var gTestWithoutMsid = false;
13 var gLocalStream = null; 13 var gLocalStream = null;
14 var gSentTones = ''; 14 var gSentTones = '';
15 var gForceIsac16K = false;
15 16
16 var gRemoteStreams = {}; 17 var gRemoteStreams = {};
17 18
18 // Default transform functions, overridden by some test cases. 19 // Default transform functions, overridden by some test cases.
19 var transformSdp = function(sdp) { return sdp; }; 20 var transformSdp = function(sdp) { return gForceIsac16K ? forceIsac16k_(sdp) : sdp; };
20 var transformRemoteSdp = function(sdp) { return sdp; }; 21 var transformRemoteSdp = function(sdp) { return sdp; };
21 var transformCandidate = function(candidate) { return candidate; }; 22 var transformCandidate = function(candidate) { return candidate; };
22 var onLocalDescriptionError = function(error) { }; 23 var onLocalDescriptionError = function(error) { };
23 24
24 // When using external SDES, the crypto key is chosen by javascript. 25 // When using external SDES, the crypto key is chosen by javascript.
25 var EXTERNAL_SDES_LINES = { 26 var EXTERNAL_SDES_LINES = {
26 'audio': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 27 'audio': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
27 'inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR', 28 'inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR',
28 'video': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 29 'video': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
29 'inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj', 30 'inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj',
30 'data': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 31 'data': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
31 'inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj' 32 'inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj'
32 }; 33 };
33 34
34 // When using GICE, the ICE credentials can be chosen by javascript. 35 // When using GICE, the ICE credentials can be chosen by javascript.
35 var EXTERNAL_GICE_UFRAG = '1234567890123456'; 36 var EXTERNAL_GICE_UFRAG = '1234567890123456';
36 var EXTERNAL_GICE_PWD = '123456789012345678901234'; 37 var EXTERNAL_GICE_PWD = '123456789012345678901234';
37 38
39 /** @private */
40 function forceIsac16k_(sdp) {
41 // Remove all other codecs (not the video codecs though).
42 sdp = sdp.replace(/m=audio (\d+) RTP\/SAVPF.*\r\n/g,
43 'm=audio $1 RTP/SAVPF 103\r\n');
44 sdp = sdp.replace('a=fmtp:111 minptime=10', 'a=fmtp:103 minptime=10');
45 sdp = sdp.replace(/a=rtpmap:(?!103)\d{1,3} (?!VP8|red|ulpfec).*\r\n/g, '');
46 return sdp;
47 }
48
38 setAllEventsOccuredHandler(function() { 49 setAllEventsOccuredHandler(function() {
39 document.title = 'OK'; 50 document.title = 'OK';
40 }); 51 });
41 52
53 // Set gForceIsac16K.
54 function setForceIsac16K(force_isac_16k) {
55 gForceIsac16K = force_isac_16k;
56 }
57
42 // Test that we can setup call with an audio and video track. 58 // Test that we can setup call with an audio and video track.
43 function call(constraints) { 59 function call(constraints) {
44 createConnections(null); 60 createConnections(null);
45 navigator.webkitGetUserMedia(constraints, 61 navigator.webkitGetUserMedia(constraints,
46 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 62 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
47 waitForVideo('remote-view-1'); 63 waitForVideo('remote-view-1');
48 waitForVideo('remote-view-2'); 64 waitForVideo('remote-view-2');
49 } 65 }
50 66
51 // First calls without streams on any connections, and then adds a stream 67 // First calls without streams on any connections, and then adds a stream
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 clearInterval(waitDtmf); 257 clearInterval(waitDtmf);
242 eventOccured(); 258 eventOccured();
243 } 259 }
244 }, 100); 260 }, 100);
245 } 261 }
246 262
247 // Do the DTMF test after we have received video. 263 // Do the DTMF test after we have received video.
248 detectVideoPlaying('remote-view-2', onCallEstablished); 264 detectVideoPlaying('remote-view-2', onCallEstablished);
249 } 265 }
250 266
251 //TODO(phoglund): do this for all tests on android if this works on bots. 267 function callAndEnsureAudioIsPlaying() {
252 /** @private */
253 function forceIsac16k_(sdp) {
254 // Remove all other codecs (not the video codecs though).
255 sdp = sdp.replace(/m=audio (\d+) RTP\/SAVPF.*\r\n/g,
256 'm=audio $1 RTP/SAVPF 103\r\n');
257 sdp = sdp.replace('a=fmtp:111 minptime=10', 'a=fmtp:103 minptime=10');
258 sdp = sdp.replace(/a=rtpmap:(?!103)\d{1,3} (?!VP8|red|ulpfec).*\r\n/g, '');
259 return sdp;
260 }
261
262 function callAndEnsureAudioIsPlaying(force_isac_16k) {
263 if (force_isac_16k)
264 transformSdp = forceIsac16k_;
265 createConnections(null); 268 createConnections(null);
266 navigator.webkitGetUserMedia({audio: true, video: true}, 269 navigator.webkitGetUserMedia({audio: true, video: true},
267 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 270 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
268 271
269 // Wait until we have gathered samples and can conclude if audio is playing. 272 // Wait until we have gathered samples and can conclude if audio is playing.
270 addExpectedEvent(); 273 addExpectedEvent();
271 var onCallEstablished = function() { 274 var onCallEstablished = function() {
272 gatherAudioLevelSamples(gSecondConnection, 300, 100, 275 gatherAudioLevelSamples(gSecondConnection, 300, 100,
273 function(samples) { 276 function(samples) {
274 verifyAudioIsPlaying(samples); 277 verifyAudioIsPlaying(samples);
275 eventOccured(); 278 eventOccured();
276 }); 279 });
277 }; 280 };
278 281
279 detectVideoPlaying('remote-view-2', onCallEstablished); 282 detectVideoPlaying('remote-view-2', onCallEstablished);
280 } 283 }
281 284
282 function callAndEnsureAudioMutingWorks(force_isac_16k) { 285 function callAndEnsureAudioMutingWorks() {
283 callAndEnsureAudioIsPlaying(force_isac_16k); 286 callAndEnsureAudioIsPlaying();
284 setAllEventsOccuredHandler(function() { 287 setAllEventsOccuredHandler(function() {
285 var audioTrack = 288 var audioTrack =
286 gSecondConnection.getRemoteStreams()[0].getAudioTracks()[0]; 289 gSecondConnection.getRemoteStreams()[0].getAudioTracks()[0];
287 290
288 // Call is up, now mute the track and check everything goes silent (give 291 // Call is up, now mute the track and check everything goes silent (give
289 // it a small delay though, we don't expect it to happen instantly). 292 // it a small delay though, we don't expect it to happen instantly).
290 audioTrack.enabled = false; 293 audioTrack.enabled = false;
291 294
292 setTimeout(function() { 295 setTimeout(function() {
293 gatherAudioLevelSamples(gSecondConnection, 200, 100, function(samples) { 296 gatherAudioLevelSamples(gSecondConnection, 200, 100, function(samples) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); 630 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, '');
628 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); 631 offerSdp = offerSdp.replace('a=mid:audio\r\n', '');
629 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); 632 offerSdp = offerSdp.replace('a=mid:video\r\n', '');
630 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); 633 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, '');
631 return offerSdp; 634 return offerSdp;
632 } 635 }
633 636
634 function removeVideoCodec(offerSdp) { 637 function removeVideoCodec(offerSdp) {
635 offerSdp = offerSdp.replace('a=rtpmap:100 VP8/90000\r\n', 638 offerSdp = offerSdp.replace('a=rtpmap:100 VP8/90000\r\n',
636 'a=rtpmap:100 XVP8/90000\r\n'); 639 'a=rtpmap:100 XVP8/90000\r\n');
637 return offerSdp; 640 return gForceIsac16K ? forceIsac16k_(offerSdp) : offerSdp;
638 } 641 }
639 642
640 function removeCrypto(offerSdp) { 643 function removeCrypto(offerSdp) {
641 offerSdp = offerSdp.replace(/a=crypto.*\r\n/g, 'a=Xcrypto\r\n'); 644 offerSdp = offerSdp.replace(/a=crypto.*\r\n/g, 'a=Xcrypto\r\n');
642 offerSdp = offerSdp.replace(/a=fingerprint.*\r\n/g, ''); 645 offerSdp = offerSdp.replace(/a=fingerprint.*\r\n/g, '');
643 return offerSdp; 646 return gForceIsac16K ? forceIsac16k_(offerSdp) : offerSdp;
644 } 647 }
645 648
646 function removeBundle(sdp) { 649 function removeBundle(sdp) {
647 return sdp.replace(/a=group:BUNDLE .*\r\n/g, ''); 650 sdp = sdp.replace(/a=group:BUNDLE .*\r\n/g, '');
651 return gForceIsac16K ? forceIsac16k_(sdp) : sdp;
648 } 652 }
649 653
650 function useGice(sdp) { 654 function useGice(sdp) {
651 sdp = sdp.replace(/t=.*\r\n/g, function(subString) { 655 sdp = sdp.replace(/t=.*\r\n/g, function(subString) {
652 return subString + 'a=ice-options:google-ice\r\n'; 656 return subString + 'a=ice-options:google-ice\r\n';
653 }); 657 });
654 sdp = sdp.replace(/a=ice-ufrag:.*\r\n/g, 658 sdp = sdp.replace(/a=ice-ufrag:.*\r\n/g,
655 'a=ice-ufrag:' + EXTERNAL_GICE_UFRAG + '\r\n'); 659 'a=ice-ufrag:' + EXTERNAL_GICE_UFRAG + '\r\n');
656 sdp = sdp.replace(/a=ice-pwd:.*\r\n/g, 660 sdp = sdp.replace(/a=ice-pwd:.*\r\n/g,
657 'a=ice-pwd:' + EXTERNAL_GICE_PWD + '\r\n'); 661 'a=ice-pwd:' + EXTERNAL_GICE_PWD + '\r\n');
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 <td><canvas width="320" height="240" id="remote-view-2-canvas" 746 <td><canvas width="320" height="240" id="remote-view-2-canvas"
743 style="display:none"></canvas></td> 747 style="display:none"></canvas></td>
744 <td><canvas width="320" height="240" id="remote-view-3-canvas" 748 <td><canvas width="320" height="240" id="remote-view-3-canvas"
745 style="display:none"></canvas></td> 749 style="display:none"></canvas></td>
746 <td><canvas width="320" height="240" id="remote-view-4-canvas" 750 <td><canvas width="320" height="240" id="remote-view-4-canvas"
747 style="display:none"></canvas></td> 751 style="display:none"></canvas></td>
748 </tr> 752 </tr>
749 </table> 753 </table>
750 </body> 754 </body>
751 </html> 755 </html>
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698