OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/public/renderer/video_encode_accelerator.h" | 5 #include "content/public/renderer/video_encode_accelerator.h" |
6 | 6 |
7 #include "base/task_runner_util.h" | 7 #include "base/task_runner_util.h" |
8 #include "content/renderer/render_thread_impl.h" | 8 #include "content/renderer/render_thread_impl.h" |
9 #include "media/gpu/ipc/client/gpu_video_encode_accelerator_host.h" | 9 #include "media/gpu/ipc/client/gpu_video_encode_accelerator_host.h" |
10 #include "media/renderers/gpu_video_accelerator_factories.h" | 10 #include "media/renderers/gpu_video_accelerator_factories.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 void CreateVideoEncodeAccelerator( | 14 void CreateVideoEncodeAccelerator( |
15 const OnCreateVideoEncodeAcceleratorCallback& callback) { | 15 const OnCreateVideoEncodeAcceleratorCallback& callback) { |
16 DCHECK(!callback.is_null()); | 16 DCHECK(!callback.is_null()); |
17 | 17 |
18 media::GpuVideoAcceleratorFactories* gpu_factories = | 18 media::GpuVideoAcceleratorFactories* gpu_factories = |
19 RenderThreadImpl::current()->GetGpuFactories(); | 19 RenderThreadImpl::current()->GetGpuFactories(); |
20 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { | 20 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { |
21 callback.Run(NULL, scoped_ptr<media::VideoEncodeAccelerator>()); | 21 callback.Run(NULL, std::unique_ptr<media::VideoEncodeAccelerator>()); |
22 return; | 22 return; |
23 } | 23 } |
24 | 24 |
25 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner = | 25 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner = |
26 gpu_factories->GetTaskRunner(); | 26 gpu_factories->GetTaskRunner(); |
27 base::PostTaskAndReplyWithResult( | 27 base::PostTaskAndReplyWithResult( |
28 encode_task_runner.get(), FROM_HERE, | 28 encode_task_runner.get(), FROM_HERE, |
29 base::Bind( | 29 base::Bind( |
30 &media::GpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator, | 30 &media::GpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator, |
31 base::Unretained(gpu_factories)), | 31 base::Unretained(gpu_factories)), |
32 base::Bind(callback, encode_task_runner)); | 32 base::Bind(callback, encode_task_runner)); |
33 } | 33 } |
34 | 34 |
35 media::VideoEncodeAccelerator::SupportedProfiles | 35 media::VideoEncodeAccelerator::SupportedProfiles |
36 GetSupportedVideoEncodeAcceleratorProfiles() { | 36 GetSupportedVideoEncodeAcceleratorProfiles() { |
37 media::GpuVideoAcceleratorFactories* gpu_factories = | 37 media::GpuVideoAcceleratorFactories* gpu_factories = |
38 RenderThreadImpl::current()->GetGpuFactories(); | 38 RenderThreadImpl::current()->GetGpuFactories(); |
39 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) | 39 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) |
40 return media::VideoEncodeAccelerator::SupportedProfiles(); | 40 return media::VideoEncodeAccelerator::SupportedProfiles(); |
41 return gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); | 41 return gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); |
42 } | 42 } |
43 | 43 |
44 } // namespace content | 44 } // namespace content |
OLD | NEW |