summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-04-06 14:56:45 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-04-07 20:37:19 +0200
commite39c986dd476daee33272de19882b82552480880 (patch)
tree7d9b82ded567d12ee8b11c82961630f767dcb7dc
parent2893bc8f0b6432b9b1c686a93cdca94a36418308 (diff)
Fix hardware accelerated video decoding
Copy initialization from gpu_main.cc to our setup. Change-Id: I8b32df76783da7783f033c3e15dd3b20b48152a8 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
-rw-r--r--src/core/content_main_delegate_qt.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 708d175f3..f93a3c0ea 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -48,6 +48,7 @@
#include "content/public/browser/browser_main_runner.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
+#include "media/gpu/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/resource/resource_bundle.h"
@@ -71,8 +72,23 @@
#include "ui/base/ui_base_switches.h"
#endif
+// must be included before vaapi_wrapper.h
#include <QtCore/qcoreapplication.h>
+#if defined(OS_WIN)
+#include "media/gpu/windows/dxva_video_decode_accelerator_win.h"
+#include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h"
+#endif
+
+#if defined(OS_MACOSX)
+#include "content/public/common/content_features.h"
+#include "media/gpu/mac/vt_video_decode_accelerator_mac.h"
+#endif
+
+#if BUILDFLAG(USE_VAAPI)
+#include "media/gpu/vaapi/vaapi_wrapper.h"
+#endif
+
namespace content {
ContentClient *GetContentClient();
}
@@ -188,6 +204,22 @@ void ContentMainDelegateQt::PreSandboxStartup()
if (parsedCommandLine->HasSwitch(switches::kSingleProcess))
setlocale(LC_NUMERIC, "C");
#endif
+
+ // from gpu_main.cc:
+#if BUILDFLAG(USE_VAAPI)
+ media::VaapiWrapper::PreSandboxInitialization();
+#endif
+#if defined(OS_WIN)
+ media::DXVAVideoDecodeAccelerator::PreSandboxInitialization();
+ media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization();
+#endif
+
+#if defined(OS_MACOSX)
+ if (base::FeatureList::IsEnabled(features::kMacV2GPUSandbox)) {
+ TRACE_EVENT0("gpu", "Initialize VideoToolbox");
+ media::InitializeVideoToolbox();
+ }
+#endif
}
content::ContentBrowserClient *ContentMainDelegateQt::CreateContentBrowserClient()