Index: content/test/data/media/getusermedia.html |
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html |
index f42ce720fd43c84433d85478fd675b7c56903838..79bb2720f44c016b6e7775e9e8fcf2ebea017b8c 100644 |
--- a/content/test/data/media/getusermedia.html |
+++ b/content/test/data/media/getusermedia.html |
@@ -393,8 +393,8 @@ |
var maxLightGreenPixelsX = 0; |
var maxLightGreenPixelsY = 0; |
- var iterations = 0; |
- var maxIterations = 10; |
+ var attempt = 0; |
+ var maxAttempts = 10; |
var detectorFunction = function() { |
var width = videoElement.videoWidth; |
@@ -431,23 +431,26 @@ |
if (lightGreenPixelsY > maxLightGreenPixelsY) |
maxLightGreenPixelsY = lightGreenPixelsY; |
- if (++iterations > maxIterations) { |
- clearInterval(detectorInterval); |
perkj_chrome
2014/10/09 14:43:22
I think you should clear the interval even if the
phoglund_chromium
2014/10/09 15:04:37
Done.
|
- // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to |
- // possible subpixel rendering on Mac and Android. |
- if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || |
- maxLightGreenPixelsY < maxLightGreenPixelsX -1 || |
- maxLightGreenPixelsY == 0 || |
- maxLightGreenPixelsX == width / 2 || |
- maxLightGreenPixelsY == height / 2) { |
+ // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to |
+ // possible subpixel rendering on Mac and Android. |
+ if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || |
+ maxLightGreenPixelsY < maxLightGreenPixelsX -1 || |
+ maxLightGreenPixelsY == 0 || |
+ maxLightGreenPixelsX == width / 2 || |
+ maxLightGreenPixelsY == height / 2) { |
+ if (++attempt > maxAttempts) { |
failTest("Aspect ratio corrupted. X " + maxLightGreenPixelsX + |
- " Y " + maxLightGreenPixelsY); |
+ " Y " + maxLightGreenPixelsY); |
+ } |
+ else { |
+ // We have a bad aspect ratio now; give a chance to shape up. |
+ return; |
} |
- |
- var result = "w=" + width + ":h=" + height; |
- console.log(result); |
- callback(result); |
} |
+ |
+ clearInterval(detectorInterval); |
+ var result = "w=" + width + ":h=" + height; |
+ callback(result); |
} |
var detectorInterval = setInterval(detectorFunction, 50); |
} |