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

Unified Diff: webkit/media/webmediaplayer_impl.cc

Issue 12412007: Add a new API in WebMediaPlayer to do a GPU-GPU textures copy if possible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/webmediaplayer_impl.cc
diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc
index 645a508f88893161f01295b355b34c41edbaf336..a3a86a0d9239525d6d4a6729c8105ef236c994a4 100644
--- a/webkit/media/webmediaplayer_impl.cc
+++ b/webkit/media/webmediaplayer_impl.cc
@@ -25,6 +25,7 @@
#include "media/filters/audio_renderer_impl.h"
#include "media/filters/chunk_demuxer.h"
#include "media/filters/video_renderer_base.h"
+#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
@@ -655,6 +656,36 @@ void WebMediaPlayerImpl::putCurrentFrame(
delete web_video_frame;
}
+bool WebMediaPlayerImpl::videoDecodeAcceleratedByGpu()
scherkus (not reviewing) 2013/03/06 21:37:37 chromium style has { on the same line as functions
Jun Jiang 2013/03/07 13:55:04 Thanks for sharing the coding-style for chromium.
scherkus (not reviewing) 2013/03/07 23:46:09 cpplint.py should be part of depot_tools and it wi
+{
+ scoped_refptr<media::VideoFrame> video_frame;
+ {
+ base::AutoLock auto_lock(lock_);
+ video_frame = current_frame_;
+ }
+
+ if (video_frame)
+ return video_frame->format() == media::VideoFrame::NATIVE_TEXTURE && video_frame->texture_target() == GL_TEXTURE_2D;
+ return false;
+}
+
+bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(WebKit::WebGraphicsContext3D* webGraphicsContext, unsigned int texture, unsigned int internalFormat)
scherkus (not reviewing) 2013/03/06 21:37:37 In your WK patch you call videoDecodeAcceleratedBy
Ken Russell (switch to Gerrit) 2013/03/07 00:13:23 I agree; it looks redundant.
Jun Jiang 2013/03/07 13:55:04 Yes, looking at the code alone in WebMediaPlayerIm
scherkus (not reviewing) 2013/03/07 23:46:09 My preference is to keep it to one function for no
Jun Jiang 2013/03/08 01:53:28 Seeing this, it seems we'd better drop off the fun
scherkus (not reviewing) 2013/03/08 01:58:45 My preference is to always try copyVideoTextureToP
+{
+ if (!webGraphicsContext)
scherkus (not reviewing) 2013/03/06 21:37:37 is this possible or is this programmer error?
Jun Jiang 2013/03/07 13:55:04 It is basically not possible to happen in current
+ return false;
+ scoped_refptr<media::VideoFrame> video_frame;
+ {
+ base::AutoLock auto_lock(lock_);
+ video_frame = current_frame_;
+ }
+ if (video_frame && video_frame->format() == media::VideoFrame::NATIVE_TEXTURE && video_frame->texture_target() == GL_TEXTURE_2D){
+ uint32 sourceTexture = video_frame->texture_id();
+ webGraphicsContext->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, 0, internalFormat);
+ return true;
+ }
+ return false;
+}
+
#define COMPILE_ASSERT_MATCHING_STATUS_ENUM(webkit_name, chromium_name) \
COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::webkit_name) == \
static_cast<int>(media::ChunkDemuxer::chromium_name), \
« no previous file with comments | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698