Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 1315323006: webgl: optimize webgl.texSubImage2D(video) path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« media/blink/skcanvas_video_renderer.h ('K') | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« media/blink/skcanvas_video_renderer.h ('K') | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698