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

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

Issue 780713004: Load VideoToolbox even when --no-sandbox is in use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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/vt_video_decode_accelerator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/vt_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/vt_video_decode_accelerator.cc b/content/common/gpu/media/vt_video_decode_accelerator.cc
index b9dbe409ecb331083f9ce6cb2d0f427b1a3941ef..a7618f5d63993e16b285fda44affe9c2c4bd7eb1 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator.cc
+++ b/content/common/gpu/media/vt_video_decode_accelerator.cc
@@ -86,10 +86,10 @@ BuildImageConfig(CMVideoDimensions coded_dimensions) {
// not documented), then VideoToolbox will fall back on software decoding
// internally. If that happens, the likely solution is to expand the scope of
// this initialization.
-void InitializeVideoToolbox() {
+static bool InitializeVideoToolboxInternal() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableAcceleratedVideoDecode)) {
- return;
+ switches::kDisableAcceleratedVideoDecode)) {
+ return false;
}
if (!IsVtInitialized()) {
@@ -101,7 +101,7 @@ void InitializeVideoToolbox() {
paths[kModuleVt].push_back(FILE_PATH_LITERAL(
"/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox"));
if (!InitializeStubs(paths))
- return;
+ return false;
}
// Create a decoding session.
@@ -124,8 +124,7 @@ void InitializeVideoToolbox() {
if (status) {
OSSTATUS_LOG(ERROR, status) << "Failed to create CMVideoFormatDescription "
<< "while initializing VideoToolbox";
- content_common_gpu_media::UninitializeVt();
- return;
+ return false;
}
base::ScopedCFTypeRef<CFMutableDictionaryRef> decoder_config(
@@ -157,9 +156,24 @@ void InitializeVideoToolbox() {
if (status) {
OSSTATUS_LOG(ERROR, status) << "Failed to create VTDecompressionSession "
<< "while initializing VideoToolbox";
- content_common_gpu_media::UninitializeVt();
- return;
+ return false;
}
+
+ return true;
+}
+
+bool InitializeVideoToolbox() {
+ // InitializeVideoToolbox() is called during GPU process sandbox warmup,
+ // and then only from the GPU process main thread.
+ static bool attempted = false;
+ static bool succeeded = false;
+
+ if (!attempted) {
+ attempted = true;
+ succeeded = InitializeVideoToolboxInternal();
+ }
+
+ return succeeded;
}
// Route decoded frame callbacks back into the VTVideoDecodeAccelerator.
@@ -230,7 +244,7 @@ bool VTVideoDecodeAccelerator::Initialize(
DCHECK(gpu_thread_checker_.CalledOnValidThread());
client_ = client;
- if (!IsVtInitialized())
+ if (!InitializeVideoToolbox())
return false;
// Only H.264 is supported.
« no previous file with comments | « content/common/gpu/media/vt_video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698