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/numerics/safe_math.h" | 11 #include "base/numerics/safe_math.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 14 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
15 #include "content/common/gpu/gpu_channel.h" | 15 #include "content/common/gpu/gpu_channel.h" |
16 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
17 #include "content/common/gpu/media/gpu_video_accelerator_util.h" | 17 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
20 #include "media/base/bind_to_current_loop.h" | 20 #include "media/base/bind_to_current_loop.h" |
21 #include "media/base/limits.h" | 21 #include "media/base/limits.h" |
22 #include "media/base/video_frame.h" | 22 #include "media/base/video_frame.h" |
23 | 23 |
24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_LINUX) |
25 #if defined(USE_V4L2_CODEC) | 25 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
26 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 26 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
27 #endif | 27 #endif |
28 #if defined(ARCH_CPU_X86_FAMILY) | 28 #if defined(ARCH_CPU_X86_FAMILY) |
29 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 29 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
30 #endif | 30 #endif |
31 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 31 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
32 #include "content/common/gpu/media/android_video_encode_accelerator.h" | 32 #include "content/common/gpu/media/android_video_encode_accelerator.h" |
33 #endif | 33 #endif |
34 | 34 |
35 namespace content { | 35 namespace content { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (device) | 213 if (device) |
214 encoder.reset(new V4L2VideoEncodeAccelerator(device)); | 214 encoder.reset(new V4L2VideoEncodeAccelerator(device)); |
215 #endif | 215 #endif |
216 return encoder; | 216 return encoder; |
217 } | 217 } |
218 | 218 |
219 // static | 219 // static |
220 scoped_ptr<media::VideoEncodeAccelerator> | 220 scoped_ptr<media::VideoEncodeAccelerator> |
221 GpuVideoEncodeAccelerator::CreateVaapiVEA() { | 221 GpuVideoEncodeAccelerator::CreateVaapiVEA() { |
222 scoped_ptr<media::VideoEncodeAccelerator> encoder; | 222 scoped_ptr<media::VideoEncodeAccelerator> encoder; |
223 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 223 #if defined(OS_LINUX) && defined(ARCH_CPU_X86_FAMILY) |
224 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 224 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
225 if (!cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) | 225 if (!cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) |
226 encoder.reset(new VaapiVideoEncodeAccelerator()); | 226 encoder.reset(new VaapiVideoEncodeAccelerator()); |
227 #endif | 227 #endif |
228 return encoder; | 228 return encoder; |
229 } | 229 } |
230 | 230 |
231 // static | 231 // static |
232 scoped_ptr<media::VideoEncodeAccelerator> | 232 scoped_ptr<media::VideoEncodeAccelerator> |
233 GpuVideoEncodeAccelerator::CreateAndroidVEA() { | 233 GpuVideoEncodeAccelerator::CreateAndroidVEA() { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 stub_->channel()->Send(message); | 454 stub_->channel()->Send(message); |
455 } | 455 } |
456 | 456 |
457 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, | 457 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, |
458 bool succeeded) { | 458 bool succeeded) { |
459 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); | 459 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); |
460 Send(message); | 460 Send(message); |
461 } | 461 } |
462 | 462 |
463 } // namespace content | 463 } // namespace content |
OLD | NEW |