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/common/gpu/media/gpu_video_encode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/common/gpu/gpu_channel.h" | 13 #include "content/common/gpu/gpu_channel.h" |
14 #include "content/common/gpu/gpu_messages.h" | 14 #include "content/common/gpu/gpu_messages.h" |
15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
16 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
17 #include "media/base/limits.h" | 17 #include "media/base/limits.h" |
18 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
19 | 19 |
20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
21 #if defined(USE_V4L2_CODEC) | 21 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) |
22 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 22 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
| 23 // defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) |
23 #endif | 24 #endif |
24 #if defined(ARCH_CPU_X86_FAMILY) | 25 #if defined(ARCH_CPU_X86_FAMILY) |
25 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 26 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
26 #endif | 27 #endif // defined(ARCH_CPU_X86_FAMILY) |
27 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 28 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
28 #include "content/common/gpu/media/android_video_encode_accelerator.h" | 29 #include "content/common/gpu/media/android_video_encode_accelerator.h" |
29 #endif | 30 #endif |
30 | 31 |
31 namespace content { | 32 namespace content { |
32 | 33 |
33 static bool MakeDecoderContextCurrent( | 34 static bool MakeDecoderContextCurrent( |
34 const base::WeakPtr<GpuCommandBufferStub> stub) { | 35 const base::WeakPtr<GpuCommandBufferStub> stub) { |
35 if (!stub) { | 36 if (!stub) { |
36 DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; | 37 DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA); | 205 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateV4L2VEA); |
205 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA); | 206 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateVaapiVEA); |
206 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA); | 207 create_vea_fps.push_back(&GpuVideoEncodeAccelerator::CreateAndroidVEA); |
207 return create_vea_fps; | 208 return create_vea_fps; |
208 } | 209 } |
209 | 210 |
210 // static | 211 // static |
211 scoped_ptr<media::VideoEncodeAccelerator> | 212 scoped_ptr<media::VideoEncodeAccelerator> |
212 GpuVideoEncodeAccelerator::CreateV4L2VEA() { | 213 GpuVideoEncodeAccelerator::CreateV4L2VEA() { |
213 scoped_ptr<media::VideoEncodeAccelerator> encoder; | 214 scoped_ptr<media::VideoEncodeAccelerator> encoder; |
214 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | 215 #if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \ |
| 216 (defined(USE_OZONE) && defined(USE_V4L2_CODEC))) |
215 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 217 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
216 if (device) | 218 if (device) |
217 encoder.reset(new V4L2VideoEncodeAccelerator(device)); | 219 encoder.reset(new V4L2VideoEncodeAccelerator(device)); |
218 #endif | 220 #endif |
219 return encoder.Pass(); | 221 return encoder.Pass(); |
220 } | 222 } |
221 | 223 |
222 // static | 224 // static |
223 scoped_ptr<media::VideoEncodeAccelerator> | 225 scoped_ptr<media::VideoEncodeAccelerator> |
224 GpuVideoEncodeAccelerator::CreateVaapiVEA() { | 226 GpuVideoEncodeAccelerator::CreateVaapiVEA() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 stub_->channel()->Send(message); | 351 stub_->channel()->Send(message); |
350 } | 352 } |
351 | 353 |
352 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, | 354 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, |
353 bool succeeded) { | 355 bool succeeded) { |
354 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); | 356 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); |
355 Send(message); | 357 Send(message); |
356 } | 358 } |
357 | 359 |
358 } // namespace content | 360 } // namespace content |
OLD | NEW |