haikuwebkit/LayoutTests/media/video-canvas-drawing.html

52 lines
1.5 KiB
HTML
Raw Permalink Normal View History

[Mac] Drawing video into canvas doesn't work on the first attempt https://bugs.webkit.org/show_bug.cgi?id=122404 Patch by Jer Noble <jer.noble@apple.com> on 2013-10-07 Reviewed by Eric Carlson. Source/WebCore: Test: media/video-canvas-drawing.html If creating and painting from an AVPlayerItemVideoOutput fails, fall back to the (much slower) AVAssetImageGenerator path. Make sure to revert to the AVPlayerItemVideoOutput path when that object begins to have available images, however. To do so, remove the "__MAC_OS_X_VERSION_MIN_REQUIRED < 1080" check around the AVAssetImageGenerator code, and allow both the image generator and video output to exist simultaneously. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::hasContextRenderer): (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer): (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator): (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext): (WebCore::MediaPlayerPrivateAVFoundationObjC::videoOutputHasAvailableFrame): (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): LayoutTests: * media/video-canvas-drawing-expected.png: Added. * media/video-canvas-drawing-expected.txt: Added. * media/video-canvas-drawing.html: Added. Canonical link: https://commits.webkit.org/140526@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157055 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-07 20:04:46 +00:00
<html>
<head>
<title>Drawing to canvas using video</title>
<script src=media-file.js></script>
<script>
var video;
var numberOfSeeks = 4;
var requirePixelDump = true;
if (window.testRunner) {
testRunner.dumpAsText(true);
testRunner.waitUntilDone();
}
function drawAndInsertFrame()
{
var canvas = document.createElement('canvas');
canvas.width = video.videoWidth / 2;
canvas.height = video.videoHeight / 2;
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
document.getElementById('canvases').appendChild(canvas);
if (--numberOfSeeks) {
video.currentTime += 1;
return;
}
endTest();
}
function canplaythrough()
{
video.currentTime = 3;
}
function start()
{
findMediaElement();
waitForEvent('canplaythrough', canplaythrough);
waitForEvent('seeked', drawAndInsertFrame);
video.src = findMediaFile('video', 'content/counting');
}
</script>
<script src=video-test.js></script>
</head>
<body onload="start()">
<video id="video"></video>
<div id="canvases"></div>
</body>
</html>