Index: media/gpu/dxva_video_decode_accelerator_win.cc |
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc |
index 0c74f4eb47c7bbb9d1369ba04fc66622f851e5a7..b69867d10738e39fa53dafce3bc16075deff9a31 100644 |
--- a/media/gpu/dxva_video_decode_accelerator_win.cc |
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc |
@@ -51,6 +51,27 @@ |
namespace { |
+// AMD |
+// Path is appended on to the PROGRAM_FILES base path. |
+const wchar_t kAMDVPXDecoderDLLPath[] = |
+ L"Common Files\\ATI Technologies\\Multimedia\\"; |
+ |
+const wchar_t kAMDVP9DecoderDLLName[] = |
+#if defined(ARCH_CPU_X86) |
+ L"amf-mft-decvp9-decoder32.dll"; |
+#elif defined(ARCH_CPU_X86_64) |
+ L"amf-mft-decvp9-decoder64.dll"; |
+#else |
+#error Unsupported Windows CPU Architecture |
+#endif |
+ |
+const CLSID CLSID_AMDWebmMfVp9Dec = { |
+ 0x2d2d728a, |
+ 0x67d6, |
+ 0x48ab, |
+ {0x89, 0xfb, 0xa6, 0xec, 0x65, 0x55, 0x49, 0x70}}; |
+ |
+// Intel |
// Path is appended on to the PROGRAM_FILES base path. |
const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; |
@@ -1422,39 +1443,58 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(VideoCodecProfile profile) { |
profile == VP9PROFILE_PROFILE1 || |
profile == VP9PROFILE_PROFILE2 || |
profile == VP9PROFILE_PROFILE3)) { |
- if (profile != VP8PROFILE_ANY) { |
+ if (profile != VP8PROFILE_ANY && |
+ (enable_accelerated_vpx_decode_ & |
+ gpu::GpuPreferences::VPX_VENDOR_MICROSOFT)) { |
codec_ = kCodecVP9; |
clsid = CLSID_MSVPxDecoder; |
decoder_dll = ::LoadLibrary(kMSVP9DecoderDLLName); |
if (decoder_dll) |
using_ms_vp9_mft_ = true; |
} |
- if (!decoder_dll) { |
- int program_files_key = base::DIR_PROGRAM_FILES; |
- if (base::win::OSInfo::GetInstance()->wow64_status() == |
- base::win::OSInfo::WOW64_ENABLED) { |
- program_files_key = base::DIR_PROGRAM_FILES6432; |
- } |
+ int program_files_key = base::DIR_PROGRAM_FILES; |
+ if (base::win::OSInfo::GetInstance()->wow64_status() == |
+ base::win::OSInfo::WOW64_ENABLED) { |
+ program_files_key = base::DIR_PROGRAM_FILES6432; |
+ } |
+ |
+ // Intel |
+ if (!decoder_dll && (enable_accelerated_vpx_decode_ & |
+ gpu::GpuPreferences::VPX_VENDOR_INTEL)) { |
base::FilePath dll_path; |
- RETURN_ON_FAILURE(PathService::Get(program_files_key, &dll_path), |
- "failed to get path for Program Files", false); |
- |
- dll_path = dll_path.Append(kVPXDecoderDLLPath); |
- if (profile == VP8PROFILE_ANY) { |
- codec_ = kCodecVP8; |
- dll_path = dll_path.Append(kVP8DecoderDLLName); |
- clsid = CLSID_WebmMfVp8Dec; |
- } else { |
- codec_ = kCodecVP9; |
- dll_path = dll_path.Append(kVP9DecoderDLLName); |
- clsid = CLSID_WebmMfVp9Dec; |
+ if (PathService::Get(program_files_key, &dll_path)) { |
+ dll_path = dll_path.Append(kVPXDecoderDLLPath); |
+ if (profile == VP8PROFILE_ANY) { |
+ codec_ = media::kCodecVP8; |
+ dll_path = dll_path.Append(kVP8DecoderDLLName); |
+ clsid = CLSID_WebmMfVp8Dec; |
+ } else { |
+ codec_ = media::kCodecVP9; |
+ dll_path = dll_path.Append(kVP9DecoderDLLName); |
+ clsid = CLSID_WebmMfVp9Dec; |
+ } |
+ decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL, |
+ LOAD_WITH_ALTERED_SEARCH_PATH); |
} |
- decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL, |
- LOAD_WITH_ALTERED_SEARCH_PATH); |
} |
- RETURN_ON_FAILURE(decoder_dll, "vpx decoder dll is not loaded", false); |
- } else { |
+ // AMD |
+ if (!decoder_dll && |
+ enable_accelerated_vpx_decode_ & gpu::GpuPreferences::VPX_VENDOR_AMD && |
+ profile == VP9PROFILE_PROFILE0) { |
+ base::FilePath dll_path; |
+ if (PathService::Get(program_files_key, &dll_path)) { |
+ codec_ = media::kCodecVP9; |
+ dll_path = dll_path.Append(kAMDVPXDecoderDLLPath); |
+ dll_path = dll_path.Append(kAMDVP9DecoderDLLName); |
+ clsid = CLSID_AMDWebmMfVp9Dec; |
+ decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL, |
+ LOAD_WITH_ALTERED_SEARCH_PATH); |
+ } |
+ } |
+ } |
+ |
+ if (!decoder_dll) { |
RETURN_ON_FAILURE(false, "Unsupported codec.", false); |
} |