Chromium Code Reviews| 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 3d58c90055b2b4ac15fbbc1830d68b3ee8d67504..f1cf0d2d2bcbcf9f0929ff3069df39f5ae8b3c9a 100644 |
| --- a/content/common/gpu/media/dxva_video_decode_accelerator.cc |
| +++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
| @@ -656,12 +656,10 @@ bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
| // See http://crbug.com/339678 for details. |
| HMODULE dxgi_manager_dll = NULL; |
| if ((dxgi_manager_dll = ::GetModuleHandle(L"MFPlat.dll")) == NULL) { |
|
jbauman
2015/11/04 23:02:02
Remove this if - do 'HMODULE dxgi_manager_dll = ::
ananta
2015/11/04 23:15:08
Done.
|
| - HMODULE mfplat_dll = ::LoadLibrary(L"MFPlat.dll"); |
| - RETURN_ON_FAILURE(mfplat_dll, "MFPlat.dll is required for decoding", |
| + RETURN_ON_FAILURE(dxgi_manager_dll, "MFPlat.dll is required for decoding", |
| false); |
| // On Windows 8+ mfplat.dll provides the MFCreateDXGIDeviceManager API. |
| // On Windows 7 mshtmlmedia.dll provides it. |
| - dxgi_manager_dll = mfplat_dll; |
| } |
| // TODO(ananta) |
| @@ -672,9 +670,8 @@ bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
| #if defined ENABLE_DX11_FOR_WIN7 |
| if ((base::win::GetVersion() == base::win::VERSION_WIN7) && |
| ((dxgi_manager_dll = ::GetModuleHandle(L"mshtmlmedia.dll")) == NULL)) { |
| - HMODULE mshtml_media_dll = ::LoadLibrary(L"mshtmlmedia.dll"); |
| - if (mshtml_media_dll) |
| - dxgi_manager_dll = mshtml_media_dll; |
| + RETURN_ON_FAILURE(dxgi_manager_dll, |
| + "mshtmlmedia.dll is required for decoding", false); |
| } |
| #endif |
| // If we don't find the MFCreateDXGIDeviceManager API we fallback to D3D9 |
| @@ -819,7 +816,7 @@ bool DXVAVideoDecodeAccelerator::CreateDX11DevManager() { |
| d3d11_query_.Receive()); |
| RETURN_ON_HR_FAILURE(hr, "Failed to create DX11 device query", false); |
| - HMODULE video_processor_dll = ::LoadLibrary(L"msvproc.dll"); |
| + HMODULE video_processor_dll = ::GetModuleHandle(L"msvproc.dll"); |
| RETURN_ON_FAILURE(video_processor_dll, "Failed to load video processor", |
| false); |
| @@ -1035,6 +1032,21 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles() { |
| return profiles; |
| } |
| +// static |
| +void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { |
| + ::LoadLibrary(L"MFPlat.dll"); |
| + ::LoadLibrary(L"msmpeg2vdec.dll"); |
| + |
| + if (base::win::GetVersion() > base::win::VERSION_WIN7) { |
| + LoadLibrary(L"msvproc.dll"); |
| + } else { |
| + LoadLibrary(L"dxva2.dll"); |
| +#if defined ENABLE_DX11_FOR_WIN7 |
| + LoadLibrary(L"mshtmlmedia.dll"); |
| +#endif |
| + } |
| +} |
| + |
| bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| HMODULE decoder_dll = NULL; |
| @@ -1046,7 +1058,7 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| // was previously done because it failed inside the sandbox, and now is done |
| // as a more minimal approach to avoid other side-effects CCI might have (as |
| // we are still in a reduced sandbox). |
| - decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); |
| + decoder_dll = ::GetModuleHandle(L"msmpeg2vdec.dll"); |
| RETURN_ON_FAILURE(decoder_dll, |
| "msmpeg2vdec.dll required for decoding is not loaded", |
| false); |