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

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

Issue 216523003: Tighten up webrtc audio tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 284 }
285 285
286 function callAndEnsureAudioIsPlaying() { 286 function callAndEnsureAudioIsPlaying() {
287 createConnections(null); 287 createConnections(null);
288 navigator.webkitGetUserMedia({audio: true, video: true}, 288 navigator.webkitGetUserMedia({audio: true, video: true},
289 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 289 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
290 290
291 // Wait until we have gathered samples and can conclude if audio is playing. 291 // Wait until we have gathered samples and can conclude if audio is playing.
292 addExpectedEvent(); 292 addExpectedEvent();
293 var onCallEstablished = function() { 293 var onCallEstablished = function() {
294 gatherAudioLevelSamples(gSecondConnection, 300, 100, 294 // Gather 10 samples per second for 4 seconds.
295 function(samples) { 295 gatherAudioLevelSamples(gSecondConnection, 40, 10, function(samples) {
phoglund_chromium 2014/03/28 13:55:26 Ok, I doubled the beep frequency and halved the ga
296 verifyAudioIsPlaying(samples); 296 verifyAudioIsPlaying(samples);
297 eventOccured(); 297 eventOccured();
298 }); 298 });
299 299
300 // (Also, ensure video muting doesn't affect audio). 300 // (Also, ensure video muting doesn't affect audio).
301 enableRemoteVideo(gSecondConnection, false); 301 enableRemoteVideo(gSecondConnection, false);
302 }; 302 };
303 303
304 detectVideoPlaying('remote-view-2', onCallEstablished); 304 detectVideoPlaying('remote-view-2', onCallEstablished);
305 } 305 }
306 306
307 function callAndEnsureAudioTrackMutingWorks() { 307 function callAndEnsureAudioTrackMutingWorks() {
308 callAndEnsureAudioIsPlaying(); 308 callAndEnsureAudioIsPlaying();
309 setAllEventsOccuredHandler(function() { 309 setAllEventsOccuredHandler(function() {
310 // Call is up, now mute the track and check everything goes silent (give 310 // Call is up, now mute the track and check everything goes silent (give
311 // it a small delay though, we don't expect it to happen instantly). 311 // it a small delay though, we don't expect it to happen instantly).
312 enableRemoteAudio(gSecondConnection, false); 312 enableRemoteAudio(gSecondConnection, false);
313 313
314 setTimeout(function() { 314 setTimeout(function() {
315 gatherAudioLevelSamples(gSecondConnection, 200, 100, function(samples) { 315 gatherAudioLevelSamples(gSecondConnection, 20, 10, function(samples) {
316 verifyIsSilent(samples); 316 verifyIsSilent(samples);
317 reportTestSuccess(); 317 reportTestSuccess();
318 }); 318 });
319 }, 500); 319 }, 500);
320 }); 320 });
321 } 321 }
322 322
323 function callAndEnsureAudioTrackUnmutingWorks() { 323 function callAndEnsureAudioTrackUnmutingWorks() {
324 callAndEnsureAudioIsPlaying(); 324 callAndEnsureAudioIsPlaying();
325 setAllEventsOccuredHandler(function() { 325 setAllEventsOccuredHandler(function() {
326 // Mute, wait a while, unmute, verify audio gets back up. 326 // Mute, wait a while, unmute, verify audio gets back up.
327 enableRemoteAudio(gSecondConnection, false); 327 enableRemoteAudio(gSecondConnection, false);
328 328
329 setTimeout(function() { 329 setTimeout(function() {
330 enableRemoteAudio(gSecondConnection, true); 330 enableRemoteAudio(gSecondConnection, true);
331 }, 500); 331 }, 500);
332 332
333 setTimeout(function() { 333 setTimeout(function() {
334 gatherAudioLevelSamples(gSecondConnection, 200, 100, function(samples) { 334 gatherAudioLevelSamples(gSecondConnection, 40, 10, function(samples) {
perkj_chrome 2014/03/28 13:29:17 why is this 40 samples to check for playing while
phoglund_chromium 2014/03/28 13:55:26 We need more of a safety margin when determining i
335 verifyAudioIsPlaying(samples); 335 verifyAudioIsPlaying(samples);
336 reportTestSuccess(); 336 reportTestSuccess();
337 }); 337 });
338 }, 1000); 338 }, 1000);
339 }); 339 });
340 } 340 }
341 341
342 function callAndEnsureVideoTrackMutingWorks() { 342 function callAndEnsureVideoTrackMutingWorks() {
343 createConnections(null); 343 createConnections(null);
344 navigator.webkitGetUserMedia({audio: true, video: true}, 344 navigator.webkitGetUserMedia({audio: true, video: true},
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 <td><canvas width="320" height="240" id="remote-view-2-canvas" 840 <td><canvas width="320" height="240" id="remote-view-2-canvas"
841 style="display:none"></canvas></td> 841 style="display:none"></canvas></td>
842 <td><canvas width="320" height="240" id="remote-view-3-canvas" 842 <td><canvas width="320" height="240" id="remote-view-3-canvas"
843 style="display:none"></canvas></td> 843 style="display:none"></canvas></td>
844 <td><canvas width="320" height="240" id="remote-view-4-canvas" 844 <td><canvas width="320" height="240" id="remote-view-4-canvas"
845 style="display:none"></canvas></td> 845 style="display:none"></canvas></td>
846 </tr> 846 </tr>
847 </table> 847 </table>
848 </body> 848 </body>
849 </html> 849 </html>
OLDNEW
« no previous file with comments | « no previous file | content/test/data/media/webrtc_test_audio.js » ('j') | content/test/data/media/webrtc_test_audio.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698