OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
5 $ = function(id) { | 5 $ = function(id) { |
6 return document.getElementById(id); | 6 return document.getElementById(id); |
7 }; | 7 }; |
8 | 8 |
9 setAllEventsOccuredHandler(function() { | 9 setAllEventsOccuredHandler(function() { |
10 reportTestSuccess(); | 10 reportTestSuccess(); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // We are interested in a window starting from the center of the image | 476 // We are interested in a window starting from the center of the image |
477 // where we expect the circle from the fake video capture to be rolling. | 477 // where we expect the circle from the fake video capture to be rolling. |
478 var pixels = context.getImageData(width / 2, height / 2, | 478 var pixels = context.getImageData(width / 2, height / 2, |
479 aperture, aperture); | 479 aperture, aperture); |
480 | 480 |
481 var lightGreenPixelsX = 0; | 481 var lightGreenPixelsX = 0; |
482 var lightGreenPixelsY = 0; | 482 var lightGreenPixelsY = 0; |
483 | 483 |
484 // Walk horizontally counting light green pixels. | 484 // Walk horizontally counting light green pixels. |
485 for (var x = 0; x < aperture; ++x) { | 485 for (var x = 0; x < aperture; ++x) { |
486 if (pixels.data[4 * x + 1] != COLOR_BACKGROUND_GREEN) | 486 if (!isAlmostBackgroundGreen(pixels.data[4 * x + 1])) |
487 lightGreenPixelsX++; | 487 lightGreenPixelsX++; |
488 } | 488 } |
489 // Walk vertically counting light green pixels. | 489 // Walk vertically counting light green pixels. |
490 for (var y = 0; y < aperture; ++y) { | 490 for (var y = 0; y < aperture; ++y) { |
491 if (pixels.data[4 * y * aperture + 1] != COLOR_BACKGROUND_GREEN) | 491 if (!isAlmostBackgroundGreen(pixels.data[4 * y * aperture + 1])) |
492 lightGreenPixelsY++; | 492 lightGreenPixelsY++; |
493 } | 493 } |
494 if (lightGreenPixelsX > maxLightGreenPixelsX) | 494 if (lightGreenPixelsX > maxLightGreenPixelsX) |
495 maxLightGreenPixelsX = lightGreenPixelsX; | 495 maxLightGreenPixelsX = lightGreenPixelsX; |
496 if (lightGreenPixelsY > maxLightGreenPixelsY) | 496 if (lightGreenPixelsY > maxLightGreenPixelsY) |
497 maxLightGreenPixelsY = lightGreenPixelsY; | 497 maxLightGreenPixelsY = lightGreenPixelsY; |
498 | 498 |
499 // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to | 499 // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to |
500 // possible subpixel rendering on Mac and Android. | 500 // possible subpixel rendering on Mac and Android. |
501 if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || | 501 if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 </tr> | 533 </tr> |
534 <tr> | 534 <tr> |
535 <td><video id="local-view-2" width="320" height="240" autoplay | 535 <td><video id="local-view-2" width="320" height="240" autoplay |
536 style="display:none"></video></td> | 536 style="display:none"></video></td> |
537 <td><canvas id="local-view-2-canvas" width="320" height="240" | 537 <td><canvas id="local-view-2-canvas" width="320" height="240" |
538 style="display:none"></canvas></td> | 538 style="display:none"></canvas></td> |
539 </tr> | 539 </tr> |
540 </table> | 540 </table> |
541 </body> | 541 </body> |
542 </html> | 542 </html> |
OLD | NEW |