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

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

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 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 76ca1b3e64eb2af8da28d511876db69142b7c034..0cf4ac7f62a000caa7077de79c34e4357b72df40 100644
--- a/content/test/data/media/webrtc_test_audio.js
+++ b/content/test/data/media/webrtc_test_audio.js
@@ -29,13 +29,15 @@ function gatherAudioLevelSamples(peerConnection, numSamples, frequency,
// audio device in media/video/capture/fake_video_capture_device.cc. Fails the
// test if we can't see a signal. The samples should have been gathered over at
// least two seconds since we expect to see at least three "peaks" in there
-// (we should see either 3 or 4 depending on how things line up). We are quite
-// generous in what we consider to be a peak since Android devices in particular
-// seem to be flake-prone (they often don't reach anywhere near the max level
-// for some reason).
-function verifyAudioIsPlaying(samples) {
+// (we should see either 3 or 4 depending on how things line up).
+//
+// If |beLenient| is specified, we assume we're running on a slow device or
+// or under TSAN, and relax the checks quite a bit.
+function verifyAudioIsPlaying(samples, beLenient) {
var numPeaks = 0;
- var threshold = MAX_AUDIO_OUTPUT_ENERGY * 0.6;
+ var threshold = MAX_AUDIO_OUTPUT_ENERGY * 0.7;
+ if (beLenient)
+ threshold = MAX_AUDIO_OUTPUT_ENERGY * 0.6;
var currentlyOverThreshold = false;
// Detect when we have been been over the threshold and is going back again
@@ -48,9 +50,14 @@ function verifyAudioIsPlaying(samples) {
console.log('Number of peaks identified: ' + numPeaks);
- if (numPeaks < 2)
- failTest('Expected to see at least two peaks in audio signal, got ' +
- numPeaks + '. Dumping samples for analysis: "' + samples + '"');
+ var expectedPeaks = 2;
+ if (beLenient)
+ expectedPeaks = 1;
+
+ if (numPeaks < expectedPeaks)
+ failTest('Expected to see at least ' + expectedPeaks + ' peak(s) in ' +
+ 'audio signal, got ' + numPeaks + '. Dumping samples for analysis: "' +
+ samples + '"');
}
// If silent (like when muted), we should get very near zero audio level.
« 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