Chromium Code Reviews| Index: content/test/data/media/webrtc_test_audio.js |
| diff --git a/content/test/data/media/webrtc_test_audio.js b/content/test/data/media/webrtc_test_audio.js |
| index 0cf4ac7f62a000caa7077de79c34e4357b72df40..72760cf87d4a27311f05cc36e1135ca38f6afe4e 100644 |
| --- a/content/test/data/media/webrtc_test_audio.js |
| +++ b/content/test/data/media/webrtc_test_audio.js |
| @@ -11,11 +11,19 @@ var MAX_AUDIO_OUTPUT_ENERGY = 32768; |
| // calls back |callback| with an array with numbers in the [0, 32768] range. |
| function gatherAudioLevelSamples(peerConnection, numSamples, frequency, |
| callback) { |
| - console.log('Gathering ' + numSamples + ' audio samples...'); |
| + console.log('Gathering ' + numSamples + ' audio samples (waiting for call ' + |
| + 'to get up if necessary)...'); |
| var audioLevelSamples = [] |
| var gatherSamples = setInterval(function() { |
| peerConnection.getStats(function(response) { |
| - audioLevelSamples.push(getAudioLevelFromStats_(response)); |
| + audioOutputLevels = getAudioLevelFromStats_(response); |
| + if (audioOutputLevels.length == 0) |
| + return; // The call probably isn't up yet. |
|
no longer working on chromium
2014/06/05 09:12:32
nit, make it look more chromium:
if (audioOutputLe
phoglund_chromium
2014/06/09 06:55:36
Done.
|
| + |
| + // If more than one audio level is reported we get confused. |
| + assertEquals(1, audioOutputLevels.length); |
| + audioLevelSamples.push(audioOutputLevels[0]); |
| + |
| if (audioLevelSamples.length == numSamples) { |
| console.log('Gathered all samples.'); |
| clearInterval(gatherSamples); |
| @@ -83,8 +91,5 @@ function getAudioLevelFromStats_(response) { |
| audioOutputLevels.push(report.stat('audioOutputLevel')); |
| } |
| } |
| - // Should only be one audio level reported, otherwise we get confused. |
| - assertEquals(1, audioOutputLevels.length); |
| - |
| - return audioOutputLevels[0]; |
| + return audioOutputLevels; |
| } |