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 ae97a7eb977ecd25e56e0e7f8fe0975ac0032c6f..a701e8dd3fb1df2ac1fdfafffa88f9b1ceeff290 100644 |
--- a/media/gpu/dxva_video_decode_accelerator_win.cc |
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc |
@@ -49,7 +49,30 @@ |
#include "ui/gl/gl_surface_egl.h" |
namespace { |
+#define INTEL_WEBM_MFT_VP9_ENABLE_MASK 0x1 |
+#define AMD_WEBM_MFT_VP9_ENABLE_MASK 0x2 |
+// 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\\"; |
@@ -1388,35 +1411,55 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(VideoCodecProfile profile) { |
"blacklisted version of msmpeg2vdec.dll 6.1.7140", false); |
codec_ = kCodecH264; |
clsid = __uuidof(CMSH264DecoderMFT); |
- } else if (enable_accelerated_vpx_decode_ && |
- (profile == VP8PROFILE_ANY || profile == VP9PROFILE_PROFILE0 || |
- profile == VP9PROFILE_PROFILE1 || |
- profile == VP9PROFILE_PROFILE2 || |
- profile == VP9PROFILE_PROFILE3)) { |
+ } else if (enable_accelerated_vpx_decode_ != 0 && |
+ (profile == media::VP8PROFILE_ANY || |
jbauman
2016/06/28 20:24:22
Shouldn't need to change this.
kplum
2016/06/28 21:35:14
Acknowledged.
|
+ profile == media::VP9PROFILE_PROFILE0 || |
+ profile == media::VP9PROFILE_PROFILE1 || |
+ profile == media::VP9PROFILE_PROFILE2 || |
+ profile == media::VP9PROFILE_PROFILE3)) { |
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; |
} |
- 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; |
+ // Intel |
+ if (enable_accelerated_vpx_decode_ & INTEL_WEBM_MFT_VP9_ENABLE_MASK) { |
+ base::FilePath dll_path; |
+ if (PathService::Get(program_files_key, &dll_path)) { |
+ dll_path = dll_path.Append(kVPXDecoderDLLPath); |
+ if (profile == media::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 == NULL && |
+ enable_accelerated_vpx_decode_ & AMD_WEBM_MFT_VP9_ENABLE_MASK && |
+ profile == media::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); |
jbauman
2016/06/28 20:24:22
Do you need to try to load this in DXVAVideoDecode
kplum
2016/06/28 21:35:14
Originally I thought I would, but then I noticed I
|
+ clsid = CLSID_AMDWebmMfVp9Dec; |
+ decoder_dll = ::LoadLibraryEx(dll_path.value().data(), NULL, |
+ LOAD_WITH_ALTERED_SEARCH_PATH); |
+ } |
+ } |
+ } |
+ |
+ // if nothing selected at this point, or dlls failed to load, |
+ // there is no support for this codec. |
+ if (decoder_dll == NULL) { |
RETURN_ON_FAILURE(false, "Unsupported codec.", false); |
} |