Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: content/common/gpu/media/dxva_video_decode_accelerator.cc

Issue 1428213003: Preload the media foundation, h.264 decoder and the dxva2.dll before the gpu sandbox is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « content/common/gpu/media/dxva_video_decode_accelerator.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698