| 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" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 DCHECK(!encoder_); | 185 DCHECK(!encoder_); |
| 186 #if defined(OS_CHROMEOS) && defined(USE_X11) | 186 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 187 #if defined(ARCH_CPU_ARMEL) | 187 #if defined(ARCH_CPU_ARMEL) |
| 188 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 188 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
| 189 if (!device.get()) | 189 if (!device.get()) |
| 190 return; | 190 return; |
| 191 | 191 |
| 192 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); | 192 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); |
| 193 #elif defined(ARCH_CPU_X86_FAMILY) | 193 #elif defined(ARCH_CPU_X86_FAMILY) |
| 194 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 194 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 195 if (cmd_line->HasSwitch(switches::kEnableVaapiAcceleratedVideoEncode)) | 195 if (!cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) |
| 196 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); | 196 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); |
| 197 #endif | 197 #endif |
| 198 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 198 #elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| 199 encoder_.reset(new AndroidVideoEncodeAccelerator()); | 199 encoder_.reset(new AndroidVideoEncodeAccelerator()); |
| 200 #endif | 200 #endif |
| 201 } | 201 } |
| 202 | 202 |
| 203 void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id, | 203 void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id, |
| 204 base::SharedMemoryHandle buffer_handle, | 204 base::SharedMemoryHandle buffer_handle, |
| 205 uint32 buffer_size, | 205 uint32 buffer_size, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 stub_->channel()->Send(message); | 308 stub_->channel()->Send(message); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, | 311 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, |
| 312 bool succeeded) { | 312 bool succeeded) { |
| 313 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); | 313 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); |
| 314 Send(message); | 314 Send(message); |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace content | 317 } // namespace content |
| OLD | NEW |