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

Side by Side Diff: content/renderer/media/renderer_gpu_video_accelerator_factories.cc

Issue 1306693002: media: Convert I420 VideoFrame to UYVY GpuMemoryBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. VideoFormat propagated. Test. Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 23
24 namespace content { 24 namespace content {
25 25
26 // static 26 // static
27 scoped_refptr<RendererGpuVideoAcceleratorFactories> 27 scoped_refptr<RendererGpuVideoAcceleratorFactories>
28 RendererGpuVideoAcceleratorFactories::Create( 28 RendererGpuVideoAcceleratorFactories::Create(
29 GpuChannelHost* gpu_channel_host, 29 GpuChannelHost* gpu_channel_host,
30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
31 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 31 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
32 unsigned image_texture_target, 32 unsigned image_texture_target,
33 media::VideoPixelFormat video_frame_pixel_format,
33 bool enable_video_accelerator) { 34 bool enable_video_accelerator) {
34 scoped_refptr<RendererGpuVideoAcceleratorFactories> factories = 35 scoped_refptr<RendererGpuVideoAcceleratorFactories> factories =
35 new RendererGpuVideoAcceleratorFactories(gpu_channel_host, task_runner, 36 new RendererGpuVideoAcceleratorFactories(
36 context_provider, 37 gpu_channel_host, task_runner, context_provider, image_texture_target,
37 image_texture_target, 38 video_frame_pixel_format, enable_video_accelerator);
38 enable_video_accelerator);
39 // Post task from outside constructor, since AddRef()/Release() is unsafe from 39 // Post task from outside constructor, since AddRef()/Release() is unsafe from
40 // within. 40 // within.
41 task_runner->PostTask( 41 task_runner->PostTask(
42 FROM_HERE, 42 FROM_HERE,
43 base::Bind(&RendererGpuVideoAcceleratorFactories::BindContext, 43 base::Bind(&RendererGpuVideoAcceleratorFactories::BindContext,
44 factories)); 44 factories));
45 return factories; 45 return factories;
46 } 46 }
47 47
48 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories( 48 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories(
49 GpuChannelHost* gpu_channel_host, 49 GpuChannelHost* gpu_channel_host,
50 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 50 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
51 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 51 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
52 unsigned image_texture_target, 52 unsigned image_texture_target,
53 media::VideoPixelFormat video_frame_pixel_format,
53 bool enable_video_accelerator) 54 bool enable_video_accelerator)
54 : task_runner_(task_runner), 55 : task_runner_(task_runner),
55 gpu_channel_host_(gpu_channel_host), 56 gpu_channel_host_(gpu_channel_host),
56 context_provider_(context_provider), 57 context_provider_(context_provider),
57 image_texture_target_(image_texture_target), 58 image_texture_target_(image_texture_target),
59 video_frame_pixel_format_(video_frame_pixel_format),
58 video_accelerator_enabled_(enable_video_accelerator), 60 video_accelerator_enabled_(enable_video_accelerator),
59 gpu_memory_buffer_manager_( 61 gpu_memory_buffer_manager_(ChildThreadImpl::current()
60 ChildThreadImpl::current()->gpu_memory_buffer_manager()), 62 ->gpu_memory_buffer_manager()),
61 thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) { 63 thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {
62 DCHECK(gpu_channel_host_.get()); 64 DCHECK(gpu_channel_host_.get());
63 } 65 }
64 66
65 RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {} 67 RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {}
66 68
67 void RendererGpuVideoAcceleratorFactories::BindContext() { 69 void RendererGpuVideoAcceleratorFactories::BindContext() {
68 DCHECK(task_runner_->BelongsToCurrentThread()); 70 DCHECK(task_runner_->BelongsToCurrentThread());
69 if (!context_provider_->BindToCurrentThread()) 71 if (!context_provider_->BindToCurrentThread())
70 context_provider_ = NULL; 72 context_provider_ = NULL;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); 221 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
220 if (!context) 222 if (!context)
221 return false; 223 return false;
222 return context->GetImplementation()->capabilities().texture_rg; 224 return context->GetImplementation()->capabilities().texture_rg;
223 } 225 }
224 226
225 unsigned RendererGpuVideoAcceleratorFactories::ImageTextureTarget() { 227 unsigned RendererGpuVideoAcceleratorFactories::ImageTextureTarget() {
226 return image_texture_target_; 228 return image_texture_target_;
227 } 229 }
228 230
231 media::VideoPixelFormat
232 RendererGpuVideoAcceleratorFactories::VideoFramePixelFormat() {
233 return video_frame_pixel_format_;
234 }
235
229 gpu::gles2::GLES2Interface* 236 gpu::gles2::GLES2Interface*
230 RendererGpuVideoAcceleratorFactories::GetGLES2Interface() { 237 RendererGpuVideoAcceleratorFactories::GetGLES2Interface() {
231 DCHECK(task_runner_->BelongsToCurrentThread()); 238 DCHECK(task_runner_->BelongsToCurrentThread());
232 239
233 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); 240 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
234 if (!context) 241 if (!context)
235 return nullptr; 242 return nullptr;
236 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); 243 gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation();
237 return gles2; 244 return gles2;
238 } 245 }
(...skipping 23 matching lines...) Expand all
262 269
263 media::VideoEncodeAccelerator::SupportedProfiles 270 media::VideoEncodeAccelerator::SupportedProfiles
264 RendererGpuVideoAcceleratorFactories:: 271 RendererGpuVideoAcceleratorFactories::
265 GetVideoEncodeAcceleratorSupportedProfiles() { 272 GetVideoEncodeAcceleratorSupportedProfiles() {
266 return GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles( 273 return GpuVideoAcceleratorUtil::ConvertGpuToMediaEncodeProfiles(
267 gpu_channel_host_->gpu_info() 274 gpu_channel_host_->gpu_info()
268 .video_encode_accelerator_supported_profiles); 275 .video_encode_accelerator_supported_profiles);
269 } 276 }
270 277
271 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698