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

Unified Diff: content/renderer/media/renderer_gpu_video_accelerator_factories.cc

Issue 1133563010: Add a GpuMemoryBuffer pool that creates hardware backed VideoFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman@'s nits. Created 5 years, 7 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 | « content/renderer/media/renderer_gpu_video_accelerator_factories.h ('k') | media/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/renderer_gpu_video_accelerator_factories.cc
diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
index 0a75c4660865f0060c8e4b8ab5936dd44c564c80..e7efe2904e28171b8f0cee2cb82a3daedec625dc 100644
--- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
@@ -8,6 +8,7 @@
#include <GLES2/gl2ext.h>
#include "base/bind.h"
+#include "content/child/child_gpu_memory_buffer_manager.h"
#include "content/child/child_thread_impl.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/gl_helper.h"
@@ -16,6 +17,7 @@
#include "content/common/gpu/media/gpu_video_accelerator_util.h"
#include "content/renderer/render_thread_impl.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
+#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "media/video/video_decode_accelerator.h"
#include "media/video/video_encode_accelerator.h"
@@ -46,7 +48,10 @@ RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories(
: task_runner_(task_runner),
gpu_channel_host_(gpu_channel_host),
context_provider_(context_provider),
- thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {}
+ gpu_memory_buffer_manager_(
+ ChildThreadImpl::current()->gpu_memory_buffer_manager()),
+ thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {
+}
RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {}
@@ -185,6 +190,37 @@ void RendererGpuVideoAcceleratorFactories::WaitSyncPoint(uint32 sync_point) {
gles2->ShallowFlushCHROMIUM();
}
+scoped_ptr<gfx::GpuMemoryBuffer>
+RendererGpuVideoAcceleratorFactories::AllocateGpuMemoryBuffer(
+ const gfx::Size& size,
+ gfx::GpuMemoryBuffer::Format format,
+ gfx::GpuMemoryBuffer::Usage usage) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ scoped_ptr<gfx::GpuMemoryBuffer> buffer =
+ gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(size, format, usage);
+ return buffer.Pass();
+}
+
+bool RendererGpuVideoAcceleratorFactories::IsTextureRGSupported() {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+
+ WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
+ if (!context)
+ return false;
+ return context->GetImplementation()->capabilities().texture_rg;
+}
+
+gpu::gles2::GLES2Interface*
+RendererGpuVideoAcceleratorFactories::GetGLES2Interface() {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+
+ WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
+ if (!context)
+ return nullptr;
+ gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation();
+ return gles2;
+}
+
scoped_ptr<base::SharedMemory>
RendererGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) {
DCHECK(task_runner_->BelongsToCurrentThread());
« no previous file with comments | « content/renderer/media/renderer_gpu_video_accelerator_factories.h ('k') | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698