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

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

Issue 240403003: Adding lenient mode to WebRTC audio tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passing parameter to test instead of global. Created 6 years, 8 months 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
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;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 remoteVideoTrack = remoteStream.getVideoTracks()[0]; 293 remoteVideoTrack = remoteStream.getVideoTracks()[0];
294 remoteVideoTrack.enabled = enabled; 294 remoteVideoTrack.enabled = enabled;
295 } 295 }
296 296
297 function enableRemoteAudio(peerConnection, enabled) { 297 function enableRemoteAudio(peerConnection, enabled) {
298 remoteStream = peerConnection.getRemoteStreams()[0]; 298 remoteStream = peerConnection.getRemoteStreams()[0];
299 remoteAudioTrack = remoteStream.getAudioTracks()[0]; 299 remoteAudioTrack = remoteStream.getAudioTracks()[0];
300 remoteAudioTrack.enabled = enabled; 300 remoteAudioTrack.enabled = enabled;
301 } 301 }
302 302
303 function callAndEnsureAudioIsPlaying() { 303 function callAndEnsureAudioIsPlaying(beLenient) {
304 createConnections(null); 304 createConnections(null);
305 navigator.webkitGetUserMedia({audio: true, video: true}, 305 navigator.webkitGetUserMedia({audio: true, video: true},
306 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 306 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
307 307
308 // Wait until we have gathered samples and can conclude if audio is playing. 308 // Wait until we have gathered samples and can conclude if audio is playing.
309 addExpectedEvent(); 309 addExpectedEvent();
310 var onCallEstablished = function() { 310 var onCallEstablished = function() {
311 // Gather 50 samples per second for 2 seconds. 311 // Gather 50 samples per second for 2 seconds.
312 gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { 312 gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) {
313 verifyAudioIsPlaying(samples); 313 verifyAudioIsPlaying(samples, beLenient);
314 eventOccured(); 314 eventOccured();
315 }); 315 });
316 316
317 // (Also, ensure video muting doesn't affect audio). 317 // (Also, ensure video muting doesn't affect audio).
318 enableRemoteVideo(gSecondConnection, false); 318 enableRemoteVideo(gSecondConnection, false);
319 }; 319 };
320 320
321 detectVideoPlaying('remote-view-2', onCallEstablished); 321 detectVideoPlaying('remote-view-2', onCallEstablished);
322 } 322 }
323 323
324 function callAndEnsureAudioTrackMutingWorks() { 324 function callAndEnsureAudioTrackMutingWorks(beLenient) {
325 callAndEnsureAudioIsPlaying(); 325 callAndEnsureAudioIsPlaying(beLenient);
326 setAllEventsOccuredHandler(function() { 326 setAllEventsOccuredHandler(function() {
327 // Call is up, now mute the track and check everything goes silent (give 327 // Call is up, now mute the track and check everything goes silent (give
328 // it a small delay though, we don't expect it to happen instantly). 328 // it a small delay though, we don't expect it to happen instantly).
329 enableRemoteAudio(gSecondConnection, false); 329 enableRemoteAudio(gSecondConnection, false);
330 330
331 setTimeout(function() { 331 setTimeout(function() {
332 gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { 332 gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) {
333 verifyIsSilent(samples); 333 verifyIsSilent(samples);
334 reportTestSuccess(); 334 reportTestSuccess();
335 }); 335 });
336 }, 500); 336 }, 500);
337 }); 337 });
338 } 338 }
339 339
340 function callAndEnsureAudioTrackUnmutingWorks() { 340 function callAndEnsureAudioTrackUnmutingWorks(beLenient) {
341 callAndEnsureAudioIsPlaying(); 341 callAndEnsureAudioIsPlaying(beLenient);
342 setAllEventsOccuredHandler(function() { 342 setAllEventsOccuredHandler(function() {
343 // Mute, wait a while, unmute, verify audio gets back up. 343 // Mute, wait a while, unmute, verify audio gets back up.
344 enableRemoteAudio(gSecondConnection, false); 344 enableRemoteAudio(gSecondConnection, false);
345 345
346 setTimeout(function() { 346 setTimeout(function() {
347 enableRemoteAudio(gSecondConnection, true); 347 enableRemoteAudio(gSecondConnection, true);
348 }, 500); 348 }, 500);
349 349
350 setTimeout(function() { 350 setTimeout(function() {
351 // Sample for four seconds here; it can take a bit of time for audio to 351 // Sample for four seconds here; it can take a bit of time for audio to
352 // get back up after the unmute. 352 // get back up after the unmute.
353 gatherAudioLevelSamples(gSecondConnection, 200, 50, function(samples) { 353 gatherAudioLevelSamples(gSecondConnection, 200, 50, function(samples) {
354 verifyAudioIsPlaying(samples); 354 verifyAudioIsPlaying(samples, beLenient);
355 reportTestSuccess(); 355 reportTestSuccess();
356 }); 356 });
357 }, 1500); 357 }, 1500);
358 }); 358 });
359 } 359 }
360 360
361 function callAndEnsureVideoTrackMutingWorks() { 361 function callAndEnsureVideoTrackMutingWorks() {
362 createConnections(null); 362 createConnections(null);
363 navigator.webkitGetUserMedia({audio: true, video: true}, 363 navigator.webkitGetUserMedia({audio: true, video: true},
364 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 364 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 <td><canvas width="320" height="240" id="remote-view-2-canvas" 859 <td><canvas width="320" height="240" id="remote-view-2-canvas"
860 style="display:none"></canvas></td> 860 style="display:none"></canvas></td>
861 <td><canvas width="320" height="240" id="remote-view-3-canvas" 861 <td><canvas width="320" height="240" id="remote-view-3-canvas"
862 style="display:none"></canvas></td> 862 style="display:none"></canvas></td>
863 <td><canvas width="320" height="240" id="remote-view-4-canvas" 863 <td><canvas width="320" height="240" id="remote-view-4-canvas"
864 style="display:none"></canvas></td> 864 style="display:none"></canvas></td>
865 </tr> 865 </tr>
866 </table> 866 </table>
867 </body> 867 </body>
868 </html> 868 </html>
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_browsertest.cc ('k') | content/test/data/media/webrtc_test_audio.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698