Chromium Code Reviews| Index: content/common/gpu/media/gpu_video_decode_accelerator.cc |
| diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc |
| index 436428acd4076cee6a11cfa776bb687f4e970263..29e30ef6af764e641c7eb48081ac1abc61ae4593 100644 |
| --- a/content/common/gpu/media/gpu_video_decode_accelerator.cc |
| +++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc |
| @@ -15,6 +15,7 @@ |
| #include "content/common/gpu/gpu_channel.h" |
| #include "content/common/gpu/gpu_messages.h" |
| +#include "content/common/gpu/media/gpu_video_accelerator_util.h" |
| #include "content/public/common/content_switches.h" |
| #include "gpu/command_buffer/common/command_buffer.h" |
| #include "ipc/ipc_message_macros.h" |
| @@ -249,7 +250,8 @@ void GpuVideoDecodeAccelerator::Initialize( |
| #endif |
| // Array of Create..VDA() function pointers, maybe applicable to the current |
| - // platform. This list is ordered by priority of use. |
| + // platform. This list is ordered by priority of use and it should be the |
| + // same as the order of querying supported profiles of VDAs. |
|
Pawel Osciak
2015/03/26 08:36:39
Why do we have to query in the same order?
Wouldn
henryhsu_tw
2015/03/26 09:38:34
For example, V4L2 supports H264 with 1080p and vaa
|
| const GpuVideoDecodeAccelerator::CreateVDAFp create_vda_fps[] = { |
| &GpuVideoDecodeAccelerator::CreateDXVAVDA, |
| &GpuVideoDecodeAccelerator::CreateV4L2VDA, |
| @@ -383,6 +385,35 @@ GpuVideoDecodeAccelerator::CreateAndroidVDA() { |
| return decoder.Pass(); |
| } |
| +// static |
| +std::vector<gpu::VideoDecodeAcceleratorSupportedProfile> |
| +GpuVideoDecodeAccelerator::GetSupportedProfiles() { |
| + std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; |
| + // Query supported profiles for each VDA. The order of querying VDAs should |
| + // be the same as the order of initializing VDAs. Then the returned profile |
| + // can be initialized by corresponding VDA successfully. |
| +#if defined(OS_WIN) |
| + profiles = DXVAVideoDecodeAccelerator::GetSupportedProfiles(); |
| +#elif defined(OS_CHROMEOS) |
| +#if defined(USE_V4L2_CODEC) |
| + std::vector<media::VideoDecodeAccelerator::SupportedProfile> vda_profiles; |
| + vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); |
| + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); |
| + vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); |
| + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); |
| +#endif |
| +#if defined(ARCH_CPU_X86_FAMILY) |
| + vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles(); |
| + GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); |
| +#endif |
| +#elif defined(OS_MACOSX) |
| + profiles = VTVideoDecodeAccelerator::GetSupportedProfiles(); |
| +#elif defined(OS_ANDROID) |
| + profiles = AndroidVideoDecodeAccelerator::GetSupportedProfiles(); |
| +#endif |
| + return GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(profiles); |
| +} |
| + |
| // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
| // true, otherwise on the main thread. |
| void GpuVideoDecodeAccelerator::OnDecode( |