Index: media/blink/webmediaplayer_impl.cc |
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc |
index 1bc5cec70464474ba46592e9e3e3e70b50099d2d..f1e7ac7444799149d3acca36d86856d2ef1f62b4 100644 |
--- a/media/blink/webmediaplayer_impl.cc |
+++ b/media/blink/webmediaplayer_impl.cc |
@@ -633,6 +633,23 @@ bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
bool premultiply_alpha, |
bool flip_y) { |
TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
+ // TODO(dshwang): not include gl2.h because this method will be removed soon. |
+ const unsigned int GL_TEXTURE_2D = 0x0DE1; |
+ return copyVideoTextureToPlatformTexture(web_graphics_context, GL_TEXTURE_2D, |
+ texture, internal_format, type, 0, |
+ premultiply_alpha, flip_y); |
+} |
+ |
+bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
+ blink::WebGraphicsContext3D* web_graphics_context, |
+ unsigned int target, |
+ unsigned int texture, |
+ unsigned int internal_format, |
+ unsigned int type, |
+ int level, |
+ bool premultiply_alpha, |
+ bool flip_y) { |
+ TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
@@ -647,8 +664,38 @@ bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
->GetGLInterface(); |
SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( |
- gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, |
- flip_y); |
+ gl, video_frame.get(), target, texture, internal_format, type, level, |
+ premultiply_alpha, flip_y); |
+ return true; |
+} |
+ |
+bool WebMediaPlayerImpl::copyVideoSubTextureToPlatformTexture( |
+ blink::WebGraphicsContext3D* web_graphics_context, |
+ unsigned int target, |
+ unsigned int texture, |
+ int level, |
+ int xoffset, |
+ int yoffset, |
+ bool premultiply_alpha, |
+ bool flip_y) { |
+ TRACE_EVENT0("media", |
+ "WebMediaPlayerImpl:copyVideoSubTextureToPlatformTexture"); |
+ |
+ scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
+ |
+ if (!video_frame.get() || !video_frame->HasTextures() || |
+ media::VideoFrame::NumPlanes(video_frame->format()) != 1) { |
+ return false; |
+ } |
+ |
+ // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to |
+ // GLES2Interface. |
+ gpu::gles2::GLES2Interface* gl = |
+ static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) |
+ ->GetGLInterface(); |
+ SkCanvasVideoRenderer::CopySubVideoFrameSingleTextureToGLTexture( |
+ gl, video_frame.get(), target, texture, level, xoffset, yoffset, |
+ premultiply_alpha, flip_y); |
return true; |
} |