WebGL slow video to texture
https://bugs.webkit.org/show_bug.cgi?id=129626
Reviewed by Dean Jackson.
Support a direct GPU-to-GPU copy of video textures. Add a new AVPlayerItemVideoOutput which,
when lazily-created, will emit CVPixelBuffers which are guaranteed to be compatible with
OpenGL framebuffers. Then, use a CVOpenGLTextureCache object to convert those CVPixelBuffers
to OpenGL textures. Once the video frame is in an OpenGL texture, use an OpenGL framebuffer
to copy the underlying video texture memory to the destination texture.
The copy step uses glTexImage2D, which requires format and type parameters, so change the
signature of copyVideoTextureToPlatformTexture() to pass those parameters in.
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::copyVideoTextureToPlatformTexture): Changed signature.
* html/HTMLVideoElement.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImage2D): Changed signature.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::copyVideoTextureToPlatformTexture): Changed signature.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::copyVideoTextureToPlatformTexture): Changed signature.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createOpenGLVideoOutput): Create an OpenGL-compatible
AVPlayerItemVideoOutput.
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyOpenGLVideoOutput): Destroy same.
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastOpenGLImage): Cache the current frame, if available.
(WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture): Convert the
current frame to a texture, and use that texture to render into the destination texture.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@192607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
10 files changed