Bug 1374183 - Add a reftest to verify seeking to 0.466667 of street.mp4 should be the 15th frame. r=alwu

MozReview-Commit-ID: 39UUIkoH38S

--HG--
extra : rebase_source : b82e4bc3c2da305e4eaaa0c4dfb49b8825d2fa0c
This commit is contained in:
bechen@mozilla.com 2017-08-22 14:12:12 +08:00
parent 52b5f25c36
commit 69fdded22d
4 changed files with 61 additions and 1 deletions

View File

@ -23,7 +23,8 @@ or using nightly, the seekToNextFrame() ensure the ended event fired.
*/
//window.onload = function() { setTimeout(dumpFirstFrame, 0); };
window.onload = function() { setTimeout(dumpLastFrame, 0); };
//window.onload = function() { setTimeout(dumpLastFrame, 0); };
window.onload = function() { setTimeout(function(){dumpNthFrame(15);}, 0); };
function drawVideoToInnerHTML(v) {
var canvas = document.getElementById("canvas");
@ -44,6 +45,24 @@ function dumpFirstFrame() {
});
}
function dumpNthFrame(n) {
var video = document.getElementById("v1");
video.src = "street.mp4";
video.preload = "metadata";
function checkNthFrame() {
console.log((15-n+1)+"th Frame time is " + video.currentTime);
n--;
if (n == 0) {
drawVideoToInnerHTML(video);
} else {
video.seekToNextFrame();
}
}
video.addEventListener("loadeddata", checkNthFrame);
video.addEventListener("seeked", checkNthFrame);
}
function dumpLastFrame() {
var video = document.getElementById("v1");
video.src = "short.mp4";

View File

@ -1,3 +1,4 @@
skip-if(Android) fuzzy-if(OSX,22,49977) skip-if(winWidget) fuzzy-if(gtkWidget&&layersGPUAccelerated,70,600) HTTP(..) == short.mp4.firstframe.html short.mp4.firstframe-ref.html
skip-if(Android) fuzzy-if(OSX,23,51392) fuzzy-if(winWidget,59,76797) fuzzy-if(gtkWidget&&layersGPUAccelerated,60,1800) HTTP(..) == short.mp4.lastframe.html short.mp4.lastframe-ref.html
skip-if(Android) skip-if(winWidget) fuzzy-if(gtkWidget&&layersGPUAccelerated,55,4281) fuzzy-if(OSX,3,111852) HTTP(..) == bipbop_300_215kbps.mp4.lastframe.html bipbop_300_215kbps.mp4.lastframe-ref.html
skip-if(Android) fuzzy-if(winWidget,65,307093) HTTP(..) == street.mp4.seek.html street.mp4.15thframe-ref.html

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<!--This testing should match the 15th frame of street.mp4. The
15th frame's time is 0.466666, so seek to a time which is a little
greater than 0.466666, the display frame should be the 15th frame.
-->
<head>
<script type="text/javascript">
function doTest() {
var video = document.getElementById("v1");
video.src = "../street.mp4";
video.preload = "metadata";
video.currentTime = 0.466667;
video.addEventListener("seeked", function() {
// Since the our media pipeline send the frame to imageBridge, then fire
// seeked event, the target frame may not be showns on the screen.
// So using canvas to access the target frame in the imageContainer in
// videoElement.
var canvas = document.getElementById("canvas");
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
var ctx = canvas.getContext("2d");
ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
document.documentElement.removeAttribute('class');
});
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</head>
<body>
<video id="v1" style="position:absolute; left:0; top:0"></video>
<canvas id="canvas" style="position:absolute; left:0; top:0"></video>
</body>
</html>