Chromium Code Reviews| Index: content/test/data/media/webrtc_test_utilities.js |
| diff --git a/content/test/data/media/webrtc_test_utilities.js b/content/test/data/media/webrtc_test_utilities.js |
| index 5fd38113882b7c6bf7f9db219850291da9e4d2c6..3e623df4a12ad9e770ec081dc230ebb446800382 100644 |
| --- a/content/test/data/media/webrtc_test_utilities.js |
| +++ b/content/test/data/media/webrtc_test_utilities.js |
| @@ -187,13 +187,14 @@ function isVideoPlaying(pixels, previousPixels) { |
| } |
| function isVideoBlack(pixels) { |
| - for (var i = 0; i < pixels.length; i++) { |
| - // |pixels| is in RGBA. Ignore the alpha channel. |
| - // We allow it to be off by 1, to account for rounding errors in YUV |
| - // conversion. |
| - if (pixels[i] != 0 && pixels[i] != 1 && (i + 1) % 4 != 0) { |
| + var threshold = 20; |
| + var accumulatedLuma = 0; |
| + for (var i = 4; i < pixels.length; i += 4) { |
|
kjellander_chromium
2015/05/19 08:08:54
Please keep the comment about that |pixels| is in
phoglund_chromium
2015/05/19 09:01:19
Done.
|
| + // Use Luma as in Rec. 709: Y′709 = 0.21R + 0.72G + 0.07B; |
|
kjellander_chromium
2015/05/19 08:08:54
I'm new to color space standards, but according to
phoglund_chromium
2015/05/19 09:01:20
Done.
|
| + accumulatedLuma += |
| + 0.21 * pixels[i] + 0.72 * pixels[i + 1] + 0.07 * pixels[i + 2]; |
|
kjellander_chromium
2015/05/19 08:08:54
Can you extract what's after += to a function?
phoglund_chromium
2015/05/19 09:01:19
Done.
|
| + if (accumulatedLuma > threshold * i / 4) |
| return false; |
| - } |
| } |
| return true; |
| } |