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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 // static | 207 // static |
208 scoped_ptr<media::VideoEncodeAccelerator> | 208 scoped_ptr<media::VideoEncodeAccelerator> |
209 GpuVideoEncodeAccelerator::CreateV4L2VEA() { | 209 GpuVideoEncodeAccelerator::CreateV4L2VEA() { |
210 scoped_ptr<media::VideoEncodeAccelerator> encoder; | 210 scoped_ptr<media::VideoEncodeAccelerator> encoder; |
211 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | 211 #if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
212 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 212 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
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.Pass(); | 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_CHROMEOS) && 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.Pass(); | 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() { |
234 scoped_ptr<media::VideoEncodeAccelerator> encoder; | 234 scoped_ptr<media::VideoEncodeAccelerator> encoder; |
235 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 235 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
236 encoder.reset(new AndroidVideoEncodeAccelerator()); | 236 encoder.reset(new AndroidVideoEncodeAccelerator()); |
237 #endif | 237 #endif |
238 return encoder.Pass(); | 238 return encoder; |
239 } | 239 } |
240 | 240 |
241 void GpuVideoEncodeAccelerator::OnEncode( | 241 void GpuVideoEncodeAccelerator::OnEncode( |
242 const AcceleratedVideoEncoderMsg_Encode_Params& params) { | 242 const AcceleratedVideoEncoderMsg_Encode_Params& params) { |
243 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode: frame_id = " | 243 DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode: frame_id = " |
244 << params.frame_id << ", buffer_size=" << params.buffer_size | 244 << params.frame_id << ", buffer_size=" << params.buffer_size |
245 << ", force_keyframe=" << params.force_keyframe; | 245 << ", force_keyframe=" << params.force_keyframe; |
246 DCHECK_EQ(media::PIXEL_FORMAT_I420, input_format_); | 246 DCHECK_EQ(media::PIXEL_FORMAT_I420, input_format_); |
247 | 247 |
248 // Wrap into a SharedMemory in the beginning, so that |params.buffer_handle| | 248 // Wrap into a SharedMemory in the beginning, so that |params.buffer_handle| |
(...skipping 205 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 |