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