Index: content/common/gpu/media/dxva_video_decode_accelerator.cc |
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
index 25aae5c56163b8cc2517c0e07e72a6c62cacb12e..d80f1a0122a8b0ed96eb887ea6495e8ab1c85856 100644 |
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
@@ -103,6 +103,14 @@ DEFINE_GUID(MF_XVP_PLAYBACK_MODE, 0x3c5d293f, 0xad67, 0x4e29, 0xaf, 0x12, |
namespace content { |
+const media::VideoCodecProfile kSupportedProfiles[] = { |
wuchengli
2015/03/23 14:42:05
add static so we are not exposing it.
henryhsu
2015/03/24 10:02:44
Done.
|
+ media::H264PROFILE_BASELINE, |
+ media::H264PROFILE_MAIN, |
+ media::H264PROFILE_HIGH, |
+ media::VP8PROFILE_ANY, |
+ media::VP9PROFILE_ANY |
+}; |
+ |
CreateDXGIDeviceManager DXVAVideoDecodeAccelerator::create_dxgi_device_manager_ |
= NULL; |
@@ -534,11 +542,14 @@ bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
main_thread_task_runner_ = base::MessageLoop::current()->task_runner(); |
- if (profile != media::H264PROFILE_BASELINE && |
- profile != media::H264PROFILE_MAIN && |
- profile != media::H264PROFILE_HIGH && |
- profile != media::VP8PROFILE_ANY && |
- profile != media::VP9PROFILE_ANY) { |
+ bool profile_supported = false; |
+ for (size_t i = 0; i < arraysize(kSupportedProfiles); ++i) { |
piman
2015/03/23 20:29:30
nit: you can do for (auto supported_profile : kSup
henryhsu
2015/03/24 10:02:44
Done.
|
+ if (profile == kSupportedProfiles[i]) { |
+ profile_supported = true; |
+ break; |
+ } |
+ } |
+ if (!profile_supported) { |
RETURN_AND_NOTIFY_ON_FAILURE(false, |
"Unsupported h.264, vp8, or vp9 profile", PLATFORM_FAILURE, false); |
} |
@@ -911,6 +922,25 @@ GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
return GL_BGRA_EXT; |
} |
+// static |
+std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
+DXVAVideoDecodeAccelerator::GetSupportedProfiles() { |
+ // TODO(henryhsu): Need to ensure the profiles are actually supported. |
+ std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; |
+ for (size_t i = 0; i < arraysize(kSupportedProfiles); ++i) { |
piman
2015/03/23 20:29:30
nit: same here, for (auto supported_profile : kSup
henryhsu
2015/03/24 10:02:44
Done.
|
+ media::VideoDecodeAccelerator::SupportedProfile profile; |
+ profile.profile = kSupportedProfiles[i]; |
+ // Windows Media Foundation H.264 decoding does not support decoding videos |
+ // with any dimension smaller than 48 pixels: |
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 |
+ profile.min_resolution.SetSize(48, 48); |
+ // Use 1088 to account for 16x16 macroblocks. |
+ profile.max_resolution.SetSize(1920, 1088); |
+ profiles.push_back(profile); |
+ } |
+ return profiles; |
+} |
+ |
bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
HMODULE decoder_dll = NULL; |