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

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: Better comment. 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 | « no previous file | 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 d4ad116c39304c12eca8c2894220897269aa7b20..a3764e8cde8476e2f13aca0848c0aabf9c044c35 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator.cc
+++ b/content/common/gpu/media/vt_video_decode_accelerator.cc
@@ -32,6 +32,11 @@ using content_common_gpu_media::StubPathMap;
namespace content {
+// Track VideoToolbox loaded to make sure that loading is attempted once and
DaleCurtis 2014/12/04 01:57:31 Seems instead you should be using a LazyInstance::
sandersd (OOO until July 31) 2014/12/04 02:05:48 That seems rather complicated for this use case, s
+// only once, regardless of the --no-sandbox flag.
+static bool vt_init_attempted = false;
+static bool vt_init_successful = false;
+
// Size to use for NALU length headers in AVC format (can be 1, 2, or 4).
static const int kNALUHeaderLength = 4;
@@ -86,6 +91,8 @@ BuildImageConfig(CMVideoDimensions coded_dimensions) {
// internally. If that happens, the likely solution is to expand the scope of
// this initialization.
void InitializeVideoToolbox() {
+ vt_init_attempted = true;
+
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableAcceleratedVideoDecode)) {
return;
@@ -159,6 +166,8 @@ void InitializeVideoToolbox() {
content_common_gpu_media::UninitializeVt();
return;
}
+
+ vt_init_successful = true;
}
// Route decoded frame callbacks back into the VTVideoDecodeAccelerator.
@@ -229,7 +238,10 @@ bool VTVideoDecodeAccelerator::Initialize(
DCHECK(gpu_thread_checker_.CalledOnValidThread());
client_ = client;
- if (!IsVtInitialized())
+ if (!vt_init_attempted)
+ InitializeVideoToolbox();
+
+ if (!vt_init_successful)
return false;
// Only H.264 is supported.
@@ -474,8 +486,8 @@ void VTVideoDecodeAccelerator::DecodeTask(
return;
}
- // If there are no non-configuration units, drop the bitstream buffer by
- // returning an empty frame.
+ // If there are no image slices, drop the bitstream buffer by returning an
+ // empty frame.
if (!data_size) {
if (!FinishDelayedFrames())
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698