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 fde81acaa4f86cdf09d080032316db55ac24bc46..6c2f416b991a3f8779c4367d002babacf83e6216 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" |
@@ -273,6 +274,8 @@ void GpuVideoDecodeAccelerator::Initialize( |
std::vector<GpuVideoDecodeAccelerator::CreateVDAFp> |
GpuVideoDecodeAccelerator::CreateVDAFps() { |
std::vector<GpuVideoDecodeAccelerator::CreateVDAFp> create_vda_fps; |
+ // The order of initializing VDAs should be the same as the order of querying |
+ // supported profiles of VDAs. |
create_vda_fps.push_back(&GpuVideoDecodeAccelerator::CreateDXVAVDA); |
create_vda_fps.push_back(&GpuVideoDecodeAccelerator::CreateV4L2VDA); |
create_vda_fps.push_back(&GpuVideoDecodeAccelerator::CreateV4L2SliceVDA); |
@@ -389,6 +392,41 @@ GpuVideoDecodeAccelerator::CreateAndroidVDA() { |
return decoder.Pass(); |
} |
+// static |
+std::vector<gpu::VideoDecodeAcceleratorSupportedProfile> |
+GpuVideoDecodeAccelerator::GetSupportedProfiles() { |
+ std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; |
+ std::vector<media::VideoDecodeAccelerator::SupportedProfile> vda_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) |
+ vda_profiles = DXVAVideoDecodeAccelerator::GetSupportedProfiles(); |
+ GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); |
wuchengli
2015/03/23 08:28:08
I think we should insert directly here without cal
henryhsu
2015/03/23 10:06:35
Done.
|
+#elif defined(OS_CHROMEOS) |
+#if defined(USE_V4L2_CODEC) |
+ 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) |
+ vda_profiles = VTVideoDecodeAccelerator::GetSupportedProfiles(); |
+ GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); |
+#elif defined(OS_ANDROID) |
+ vda_profiles = AndroidVideoDecodeAccelerator::GetSupportedProfiles(); |
+ GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); |
+#else |
+ NOTIMPLEMENTED() << "HW video decode acceleration get supported resolution" |
wuchengli
2015/03/23 08:28:08
This shouldn't be an error. Just remove.
henryhsu
2015/03/23 10:06:35
Done.
|
+ << " not available."; |
+#endif // defined(OS_CHROMEOS) |
+ return GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(profiles); |
+} |
+ |
// Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
// true, otherwise on the main thread. |
void GpuVideoDecodeAccelerator::OnDecode( |