| OLD | NEW |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // Test that we can setup call with an audio and video track. | 57 // Test that we can setup call with an audio and video track. |
| 58 function call(constraints) { | 58 function call(constraints) { |
| 59 createConnections(null); | 59 createConnections(null); |
| 60 navigator.webkitGetUserMedia(constraints, | 60 navigator.webkitGetUserMedia(constraints, |
| 61 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); | 61 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); |
| 62 waitForVideo('remote-view-1'); | 62 waitForVideo('remote-view-1'); |
| 63 waitForVideo('remote-view-2'); | 63 waitForVideo('remote-view-2'); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Test that we can setup call with an audio and video track and check that | 66 // Test that we can setup call with an audio and video track and check that |
| 67 // the video resolution is as expected. | 67 // the video resolution is as expected. |
| 68 function callAndExpectResolution(constraints, | 68 function callAndExpectResolution(constraints, |
| 69 expected_width, | 69 expected_width, |
| 70 expected_height) { | 70 expected_height) { |
| 71 createConnections(null); | 71 createConnections(null); |
| 72 navigator.webkitGetUserMedia(constraints, | 72 navigator.webkitGetUserMedia(constraints, |
| 73 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); | 73 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); |
| 74 waitForVideoWithResolution('remote-view-1', | 74 waitForVideoWithResolution('remote-view-1', |
| 75 expected_width, | 75 expected_width, |
| 76 expected_height); | 76 expected_height); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 301 } |
| 302 | 302 |
| 303 function callAndEnsureAudioIsPlaying() { | 303 function callAndEnsureAudioIsPlaying() { |
| 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 gatherAudioLevelSamples(gSecondConnection, 300, 100, |
| 312 gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { | 312 function(samples) { |
| 313 verifyAudioIsPlaying(samples); | 313 verifyAudioIsPlaying(samples); |
| 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() { |
| 325 callAndEnsureAudioIsPlaying(); | 325 callAndEnsureAudioIsPlaying(); |
| 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, 200, 100, 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() { |
| 341 callAndEnsureAudioIsPlaying(); | 341 callAndEnsureAudioIsPlaying(); |
| 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 gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { | 351 gatherAudioLevelSamples(gSecondConnection, 200, 100, function(samples) { |
| 352 verifyAudioIsPlaying(samples); | 352 verifyAudioIsPlaying(samples); |
| 353 reportTestSuccess(); | 353 reportTestSuccess(); |
| 354 }); | 354 }); |
| 355 }, 1500); | 355 }, 1000); |
| 356 }); | 356 }); |
| 357 } | 357 } |
| 358 | 358 |
| 359 function callAndEnsureVideoTrackMutingWorks() { | 359 function callAndEnsureVideoTrackMutingWorks() { |
| 360 createConnections(null); | 360 createConnections(null); |
| 361 navigator.webkitGetUserMedia({audio: true, video: true}, | 361 navigator.webkitGetUserMedia({audio: true, video: true}, |
| 362 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); | 362 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); |
| 363 | 363 |
| 364 addExpectedEvent(); | 364 addExpectedEvent(); |
| 365 detectVideoPlaying('remote-view-2', function() { | 365 detectVideoPlaying('remote-view-2', function() { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 <td><canvas width="320" height="240" id="remote-view-2-canvas" | 857 <td><canvas width="320" height="240" id="remote-view-2-canvas" |
| 858 style="display:none"></canvas></td> | 858 style="display:none"></canvas></td> |
| 859 <td><canvas width="320" height="240" id="remote-view-3-canvas" | 859 <td><canvas width="320" height="240" id="remote-view-3-canvas" |
| 860 style="display:none"></canvas></td> | 860 style="display:none"></canvas></td> |
| 861 <td><canvas width="320" height="240" id="remote-view-4-canvas" | 861 <td><canvas width="320" height="240" id="remote-view-4-canvas" |
| 862 style="display:none"></canvas></td> | 862 style="display:none"></canvas></td> |
| 863 </tr> | 863 </tr> |
| 864 </table> | 864 </table> |
| 865 </body> | 865 </body> |
| 866 </html> | 866 </html> |
| OLD | NEW |