| 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) | 33 #elif defined(OS_CHROMEOS) |
| 32 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) | 34 #if defined(ARCH_CPU_ARMEL) || (defined(USE_OZONE) && defined(USE_V4L2_CODEC)) |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 GpuVideoDecodeAccelerator::CreateAndroidVDA() { | 351 GpuVideoDecodeAccelerator::CreateAndroidVDA() { |
| 350 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 352 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
| 351 #if defined(OS_ANDROID) | 353 #if defined(OS_ANDROID) |
| 352 decoder.reset(new AndroidVideoDecodeAccelerator( | 354 decoder.reset(new AndroidVideoDecodeAccelerator( |
| 353 stub_->decoder()->AsWeakPtr(), | 355 stub_->decoder()->AsWeakPtr(), |
| 354 make_context_current_)); | 356 make_context_current_)); |
| 355 #endif | 357 #endif |
| 356 return decoder.Pass(); | 358 return decoder.Pass(); |
| 357 } | 359 } |
| 358 | 360 |
| 361 // static |
| 362 gpu::VideoDecodeAcceleratorSupportedResolution |
| 363 GpuVideoDecodeAccelerator::GetSupportedResolution() { |
| 364 media::VideoDecodeAccelerator::SupportedResolution resolution; |
| 365 #if defined(OS_WIN) |
| 366 resolution = DXVAVideoDecodeAccelerator::GetSupportedResolution(); |
| 367 #elif defined(OS_MACOSX) |
| 368 resolution = VTVideoDecodeAccelerator::GetSupportedResolution(); |
| 369 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 370 resolution = V4L2VideoDecodeAccelerator::GetSupportedResolution(); |
| 371 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 372 resolution = VaapiVideoDecodeAccelerator::GetSupportedResolution(); |
| 373 #elif defined(OS_ANDROID) |
| 374 resolution = AndroidVideoDecodeAccelerator::GetSupportedResolution(); |
| 375 #elif defined(USE_OZONE) |
| 376 resolution.min.SetSize(16, 16); |
| 377 resolution.max.SetSize(1920, 1088); |
| 378 #else |
| 379 NOTIMPLEMENTED() << "HW video decode acceleration get supported resolution" |
| 380 << " not available."; |
| 381 #endif |
| 382 gpu::VideoDecodeAcceleratorSupportedResolution gpu_resolution; |
| 383 gpu_resolution.min = resolution.min; |
| 384 gpu_resolution.max = resolution.max; |
| 385 return gpu_resolution; |
| 386 } |
| 387 |
| 359 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is | 388 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
| 360 // true, otherwise on the main thread. | 389 // true, otherwise on the main thread. |
| 361 void GpuVideoDecodeAccelerator::OnDecode( | 390 void GpuVideoDecodeAccelerator::OnDecode( |
| 362 base::SharedMemoryHandle handle, int32 id, uint32 size) { | 391 base::SharedMemoryHandle handle, int32 id, uint32 size) { |
| 363 DCHECK(video_decode_accelerator_.get()); | 392 DCHECK(video_decode_accelerator_.get()); |
| 364 if (id < 0) { | 393 if (id < 0) { |
| 365 DLOG(ERROR) << "BitstreamBuffer id " << id << " out of range"; | 394 DLOG(ERROR) << "BitstreamBuffer id " << id << " out of range"; |
| 366 if (child_message_loop_->BelongsToCurrentThread()) { | 395 if (child_message_loop_->BelongsToCurrentThread()) { |
| 367 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); | 396 NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); |
| 368 } else { | 397 } else { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 return stub_->channel()->Send(message); | 584 return stub_->channel()->Send(message); |
| 556 } | 585 } |
| 557 | 586 |
| 558 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 587 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 559 bool succeeded) { | 588 bool succeeded) { |
| 560 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 589 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 561 Send(message); | 590 Send(message); |
| 562 } | 591 } |
| 563 | 592 |
| 564 } // namespace content | 593 } // namespace content |
| OLD | NEW |