| OLD | NEW |
| 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" |
| 11 #include "content/child/child_thread.h" | 11 #include "content/child/child_thread.h" |
| 12 #include "content/common/gpu/client/context_provider_command_buffer.h" | 12 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 13 #include "content/common/gpu/client/gpu_channel_host.h" | 13 #include "content/common/gpu/client/gpu_channel_host.h" |
| 14 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 14 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
| 16 #include "gpu/command_buffer/client/gles2_implementation.h" | 16 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 17 #include "media/video/video_decode_accelerator.h" |
| 18 #include "media/video/video_encode_accelerator.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 #include "third_party/skia/include/core/SkPixelRef.h" | 20 #include "third_party/skia/include/core/SkPixelRef.h" |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| 21 | 23 |
| 22 // static | 24 // static |
| 23 scoped_refptr<RendererGpuVideoAcceleratorFactories> | 25 scoped_refptr<RendererGpuVideoAcceleratorFactories> |
| 24 RendererGpuVideoAcceleratorFactories::Create( | 26 RendererGpuVideoAcceleratorFactories::Create( |
| 25 GpuChannelHost* gpu_channel_host, | 27 GpuChannelHost* gpu_channel_host, |
| 26 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, | 28 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 return NULL; | 63 return NULL; |
| 62 if (context_provider_->IsContextLost()) { | 64 if (context_provider_->IsContextLost()) { |
| 63 context_provider_->VerifyContexts(); | 65 context_provider_->VerifyContexts(); |
| 64 context_provider_ = NULL; | 66 context_provider_ = NULL; |
| 65 return NULL; | 67 return NULL; |
| 66 } | 68 } |
| 67 return context_provider_->WebContext3D(); | 69 return context_provider_->WebContext3D(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 scoped_ptr<media::VideoDecodeAccelerator> | 72 scoped_ptr<media::VideoDecodeAccelerator> |
| 71 RendererGpuVideoAcceleratorFactories::CreateVideoDecodeAccelerator( | 73 RendererGpuVideoAcceleratorFactories::CreateVideoDecodeAccelerator() { |
| 72 media::VideoCodecProfile profile) { | |
| 73 DCHECK(task_runner_->BelongsToCurrentThread()); | 74 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 74 | 75 |
| 75 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); | 76 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
| 76 if (context && context->GetCommandBufferProxy()) { | 77 if (context && context->GetCommandBufferProxy()) { |
| 77 return gpu_channel_host_->CreateVideoDecoder( | 78 return gpu_channel_host_->CreateVideoDecoder( |
| 78 context->GetCommandBufferProxy()->GetRouteID(), profile); | 79 context->GetCommandBufferProxy()->GetRouteID()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 return scoped_ptr<media::VideoDecodeAccelerator>(); | 82 return scoped_ptr<media::VideoDecodeAccelerator>(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 scoped_ptr<media::VideoEncodeAccelerator> | 85 scoped_ptr<media::VideoEncodeAccelerator> |
| 85 RendererGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator() { | 86 RendererGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator() { |
| 86 DCHECK(task_runner_->BelongsToCurrentThread()); | 87 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 87 | 88 |
| 88 return gpu_channel_host_->CreateVideoEncoder(); | 89 WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
| 90 if (context && context->GetCommandBufferProxy()) { |
| 91 return gpu_channel_host_->CreateVideoEncoder( |
| 92 context->GetCommandBufferProxy()->GetRouteID()); |
| 93 } |
| 94 |
| 95 return scoped_ptr<media::VideoEncodeAccelerator>(); |
| 89 } | 96 } |
| 90 | 97 |
| 91 uint32 RendererGpuVideoAcceleratorFactories::CreateTextures( | 98 uint32 RendererGpuVideoAcceleratorFactories::CreateTextures( |
| 92 int32 count, | 99 int32 count, |
| 93 const gfx::Size& size, | 100 const gfx::Size& size, |
| 94 std::vector<uint32>* texture_ids, | 101 std::vector<uint32>* texture_ids, |
| 95 std::vector<gpu::Mailbox>* texture_mailboxes, | 102 std::vector<gpu::Mailbox>* texture_mailboxes, |
| 96 uint32 texture_target) { | 103 uint32 texture_target) { |
| 97 DCHECK(task_runner_->BelongsToCurrentThread()); | 104 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 98 DCHECK(texture_target); | 105 DCHECK(texture_target); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 DCHECK(task_runner_->BelongsToCurrentThread()); | 226 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 220 return ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get()); | 227 return ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get()); |
| 221 } | 228 } |
| 222 | 229 |
| 223 scoped_refptr<base::SingleThreadTaskRunner> | 230 scoped_refptr<base::SingleThreadTaskRunner> |
| 224 RendererGpuVideoAcceleratorFactories::GetTaskRunner() { | 231 RendererGpuVideoAcceleratorFactories::GetTaskRunner() { |
| 225 return task_runner_; | 232 return task_runner_; |
| 226 } | 233 } |
| 227 | 234 |
| 228 } // namespace content | 235 } // namespace content |
| OLD | NEW |