| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/cpu.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 | 15 |
| 15 #include "content/common/gpu/gpu_channel.h" | 16 #include "content/common/gpu/gpu_channel.h" |
| 16 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
| 17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 18 #include "gpu/command_buffer/common/command_buffer.h" | 19 #include "gpu/command_buffer/common/command_buffer.h" |
| 19 #include "ipc/ipc_message_macros.h" | 20 #include "ipc/ipc_message_macros.h" |
| 20 #include "ipc/ipc_message_utils.h" | 21 #include "ipc/ipc_message_utils.h" |
| 21 #include "ipc/message_filter.h" | 22 #include "ipc/message_filter.h" |
| 22 #include "media/base/limits.h" | 23 #include "media/base/limits.h" |
| 24 #include "media/base/media_switches.h" |
| 23 #include "ui/gl/gl_context.h" | 25 #include "ui/gl/gl_context.h" |
| 24 #include "ui/gl/gl_surface_egl.h" | 26 #include "ui/gl/gl_surface_egl.h" |
| 25 | 27 |
| 26 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 27 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
| 28 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 30 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 29 #elif defined(OS_MACOSX) | 31 #elif defined(OS_MACOSX) |
| 30 #include "content/common/gpu/media/vt_video_decode_accelerator.h" | 32 #include "content/common/gpu/media/vt_video_decode_accelerator.h" |
| 31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 33 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
| 32 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 34 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 310 } |
| 309 | 311 |
| 310 if (!video_decode_accelerator_->Initialize(profile, this)) { | 312 if (!video_decode_accelerator_->Initialize(profile, this)) { |
| 311 SendCreateDecoderReply(init_done_msg, false); | 313 SendCreateDecoderReply(init_done_msg, false); |
| 312 return; | 314 return; |
| 313 } | 315 } |
| 314 | 316 |
| 315 SendCreateDecoderReply(init_done_msg, true); | 317 SendCreateDecoderReply(init_done_msg, true); |
| 316 } | 318 } |
| 317 | 319 |
| 320 // static |
| 321 gpu::VideoDecodeAcceleratorSupportedResolution |
| 322 GpuVideoDecodeAccelerator::GetSupportedResolution() { |
| 323 media::VideoDecodeAccelerator::SupportedResolution resolution; |
| 324 #if defined(OS_WIN) |
| 325 resolution = DXVAVideoDecodeAccelerator::GetSupportedResolution(); |
| 326 #elif defined(OS_MACOSX) |
| 327 resolution = VTVideoDecodeAccelerator::GetSupportedResolution(); |
| 328 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 329 resolution = V4L2VideoDecodeAccelerator::GetSupportedResolution(); |
| 330 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 331 resolution = VaapiVideoDecodeAccelerator::GetSupportedResolution(); |
| 332 #elif defined(OS_ANDROID) |
| 333 resolution = AndroidVideoDecodeAccelerator::GetSupportedResolution(); |
| 334 #elif defined(USE_OZONE) |
| 335 resolution.min.SetSize(16, 16); |
| 336 resolution.max.SetSize(1920, 1088); |
| 337 #else |
| 338 NOTIMPLEMENTED() << "HW video decode acceleration get supported resolution" |
| 339 << " not available."; |
| 340 #endif |
| 341 gpu::VideoDecodeAcceleratorSupportedResolution gpu_resolution; |
| 342 gpu_resolution.min = resolution.min; |
| 343 gpu_resolution.max = resolution.max; |
| 344 return gpu_resolution; |
| 345 } |
| 346 |
| 318 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is | 347 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
| 319 // true, otherwise on the main thread. | 348 // true, otherwise on the main thread. |
| 320 void GpuVideoDecodeAccelerator::OnDecode( | 349 void GpuVideoDecodeAccelerator::OnDecode( |
| 321 base::SharedMemoryHandle handle, int32 id, uint32 size) { | 350 base::SharedMemoryHandle handle, int32 id, uint32 size) { |
| 322 DCHECK(video_decode_accelerator_.get()); | 351 DCHECK(video_decode_accelerator_.get()); |
| 323 if (id < 0) { | 352 if (id < 0) { |
| 324 DLOG(ERROR) << "BitstreamBuffer id " << id << " out of range"; | 353 DLOG(ERROR) << "BitstreamBuffer id " << id << " out of range"; |
| 325 if (child_message_loop_->BelongsToCurrentThread()) { | 354 if (child_message_loop_->BelongsToCurrentThread()) { |
| 326 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 355 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 327 } else { | 356 } else { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 return stub_->channel()->Send(message); | 543 return stub_->channel()->Send(message); |
| 515 } | 544 } |
| 516 | 545 |
| 517 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 546 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 518 bool succeeded) { | 547 bool succeeded) { |
| 519 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 548 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 520 Send(message); | 549 Send(message); |
| 521 } | 550 } |
| 522 | 551 |
| 523 } // namespace content | 552 } // namespace content |
| OLD | NEW |