Commit bf510001 authored by jbauman's avatar jbauman Committed by Commit bot

Don't attempt to use hardware video decoding if mf.dll doesn't exist.

Media Foundation is missing on Windows N, so attempting to use it will
crash the GPU process.

BUG=638747

Review-Url: https://codereview.chromium.org/2256933002
Cr-Commit-Position: refs/heads/master@{#412723}
parent e11e868e
...@@ -155,6 +155,10 @@ static const DWORD g_IntelLegacyGPUList[] = { ...@@ -155,6 +155,10 @@ static const DWORD g_IntelLegacyGPUList[] = {
0x102, 0x106, 0x116, 0x126, 0x102, 0x106, 0x116, 0x126,
}; };
constexpr const wchar_t* const kMediaFoundationVideoDecoderDLLs[] = {
L"mf.dll", L"mfplat.dll", L"msmpeg2vdec.dll",
};
} // namespace } // namespace
namespace media { namespace media {
...@@ -1040,6 +1044,15 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles( ...@@ -1040,6 +1044,15 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles(
// TODO(henryhsu): Need to ensure the profiles are actually supported. // TODO(henryhsu): Need to ensure the profiles are actually supported.
SupportedProfiles profiles; SupportedProfiles profiles;
for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) {
if (!::GetModuleHandle(mfdll)) {
// Windows N is missing the media foundation DLLs unless the media
// feature pack is installed.
DVLOG(ERROR) << mfdll << " is required for hardware video decoding";
return profiles;
}
}
for (const auto& supported_profile : kSupportedProfiles) { for (const auto& supported_profile : kSupportedProfiles) {
if (!preferences.enable_accelerated_vpx_decode && if (!preferences.enable_accelerated_vpx_decode &&
(supported_profile >= VP8PROFILE_MIN) && (supported_profile >= VP8PROFILE_MIN) &&
...@@ -1060,9 +1073,8 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles( ...@@ -1060,9 +1073,8 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles(
// static // static
void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { void DXVAVideoDecodeAccelerator::PreSandboxInitialization() {
::LoadLibrary(L"MFPlat.dll"); for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs)
::LoadLibrary(L"msmpeg2vdec.dll"); ::LoadLibrary(mfdll);
::LoadLibrary(L"mf.dll");
::LoadLibrary(L"dxva2.dll"); ::LoadLibrary(L"dxva2.dll");
if (base::win::GetVersion() > base::win::VERSION_WIN7) { if (base::win::GetVersion() > base::win::VERSION_WIN7) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment