| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 453 |
| 454 var maxLightGreenPixelsX = 0; | 454 var maxLightGreenPixelsX = 0; |
| 455 var maxLightGreenPixelsY = 0; | 455 var maxLightGreenPixelsY = 0; |
| 456 | 456 |
| 457 var attempt = 0; | 457 var attempt = 0; |
| 458 var maxAttempts = 10; | 458 var maxAttempts = 10; |
| 459 | 459 |
| 460 var detectorFunction = function() { | 460 var detectorFunction = function() { |
| 461 var width = videoElement.videoWidth; | 461 var width = videoElement.videoWidth; |
| 462 var height = videoElement.videoHeight; | 462 var height = videoElement.videoHeight; |
| 463 if (width == 0 || height == 0) | 463 if (width == 0 || height == 0) { |
| 464 failTest("VideoElement width and height set to 0."); | 464 if (++attempt > maxAttempts) { |
| 465 clearInterval(detectorInterval); |
| 466 failTest("VideoElement width or height set to 0."); |
| 467 } |
| 468 else { |
| 469 // We have zero size now; give a chance to shape up. |
| 470 return; |
| 471 } |
| 472 } |
| 465 | 473 |
| 466 canvas.width = width; | 474 canvas.width = width; |
| 467 canvas.height = height; | 475 canvas.height = height; |
| 468 var aperture = Math.min(width, height) / 2; | 476 var aperture = Math.min(width, height) / 2; |
| 469 var context = canvas.getContext('2d'); | 477 var context = canvas.getContext('2d'); |
| 470 context.drawImage(videoElement, 0, 0, width, height); | 478 context.drawImage(videoElement, 0, 0, width, height); |
| 471 | 479 |
| 472 // We are interested in a window starting from the center of the image | 480 // We are interested in a window starting from the center of the image |
| 473 // where we expect the circle from the fake video capture to be rolling. | 481 // where we expect the circle from the fake video capture to be rolling. |
| 474 var pixels = context.getImageData(width / 2, height / 2, | 482 var pixels = context.getImageData(width / 2, height / 2, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 </tr> | 538 </tr> |
| 531 <tr> | 539 <tr> |
| 532 <td><video id="local-view-2" width="320" height="240" autoplay | 540 <td><video id="local-view-2" width="320" height="240" autoplay |
| 533 style="display:none"></video></td> | 541 style="display:none"></video></td> |
| 534 <td><canvas id="local-view-2-canvas" width="320" height="240" | 542 <td><canvas id="local-view-2-canvas" width="320" height="240" |
| 535 style="display:none"></canvas></td> | 543 style="display:none"></canvas></td> |
| 536 </tr> | 544 </tr> |
| 537 </table> | 545 </table> |
| 538 </body> | 546 </body> |
| 539 </html> | 547 </html> |
| OLD | NEW |