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

Unified Diff: content/test/data/media/webrtc_test_audio.js

Issue 252703003: Wrote a test which exercises audio-only WebRTC calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made fixes to audio detection 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/data/media/peerconnection-call.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « content/test/data/media/peerconnection-call.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698