tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

uneven_frame_duration_video.html (1419B)


      1 <!DOCTYPE HTML>
      2 <html class="reftest-wait">
      3 <!--Tests the fix for bug 1576990. We want to make sure the frames do not
      4    become stuck due to decoders (in particular the Windows decoder) estimating
      5    frame durations incorrectly.
      6 -->
      7 <head>
      8 <script type="text/javascript">
      9 function doTest() {
     10  var video = document.getElementById("v1");
     11  // Video from bug 1576990.
     12  video.src = "uneven_frame_durations.mp4";
     13  video.preload = "metadata";
     14 
     15  // This frame differs depending on if the Windows' decoder is estimating
     16  // frame duration or if we use Gecko durations.
     17  video.currentTime = 3.8;
     18 
     19  video.addEventListener("seeked", function() {
     20    // Since our media pipeline sends the frame to imageBridge, then fires
     21    // a seeked event, the target frame may not be shown on the screen.
     22    // So using canvas to access the target frame in the imageContainer in
     23    // videoElement.
     24    var canvas = document.getElementById("canvas");
     25    canvas.width = video.videoWidth;
     26    canvas.height = video.videoHeight;
     27    var ctx = canvas.getContext("2d");
     28    ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
     29    document.documentElement.removeAttribute("class");
     30  });
     31 }
     32 window.addEventListener("MozReftestInvalidate", doTest);
     33 </script>
     34 </head>
     35 <body>
     36 <video id="v1" style="position:absolute; left:0; top:0"></video>
     37 <canvas id="canvas" style="position:absolute; left:0; top:0"></video>
     38 </body>
     39 </html>