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

Unified Diff: media/gpu/vt_video_encode_accelerator_mac.cc

Issue 2803673004: Reland of Enforce MaxFrameDelayCount in VTVideoEncodeAccelerator and cleanups (Closed)
Patch Set: Created 3 years, 8 months 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 | « media/gpu/vt_video_encode_accelerator_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/vt_video_encode_accelerator_mac.cc
diff --git a/media/gpu/vt_video_encode_accelerator_mac.cc b/media/gpu/vt_video_encode_accelerator_mac.cc
index 77052f32653b08ce2e995fc6d218049f90f2eea8..de0d8d7ff619a6b0409c5458572a805dbf7c2daf 100644
--- a/media/gpu/vt_video_encode_accelerator_mac.cc
+++ b/media/gpu/vt_video_encode_accelerator_mac.cc
@@ -97,8 +97,7 @@
SupportedProfiles profiles;
const bool rv = CreateCompressionSession(
- video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0),
- gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true);
+ gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight));
DestroyCompressionSession();
if (!rv) {
VLOG(1)
@@ -453,22 +452,7 @@
DestroyCompressionSession();
- CFTypeRef attributes_keys[] = {kCVPixelBufferOpenGLCompatibilityKey,
- kCVPixelBufferIOSurfacePropertiesKey,
- kCVPixelBufferPixelFormatTypeKey};
- const int format[] = {kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange};
- CFTypeRef attributes_values[] = {
- kCFBooleanTrue,
- video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0).release(),
- video_toolbox::ArrayWithIntegers(format, arraysize(format)).release()};
- const base::ScopedCFTypeRef<CFDictionaryRef> attributes =
- video_toolbox::DictionaryWithKeysAndValues(
- attributes_keys, attributes_values, arraysize(attributes_keys));
- for (auto* v : attributes_values)
- CFRelease(v);
-
- bool session_rv =
- CreateCompressionSession(attributes, input_visible_size_, false);
+ bool session_rv = CreateCompressionSession(input_visible_size_);
if (!session_rv) {
DestroyCompressionSession();
return false;
@@ -481,22 +465,12 @@
}
bool VTVideoEncodeAccelerator::CreateCompressionSession(
- base::ScopedCFTypeRef<CFDictionaryRef> attributes,
- const gfx::Size& input_size,
- bool require_hw_encoding) {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- std::vector<CFTypeRef> encoder_keys;
- std::vector<CFTypeRef> encoder_values;
- if (require_hw_encoding) {
- encoder_keys.push_back(
- kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder);
- encoder_values.push_back(kCFBooleanTrue);
- } else {
- encoder_keys.push_back(
- kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder);
- encoder_values.push_back(kCFBooleanTrue);
- }
+ const gfx::Size& input_size) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ std::vector<CFTypeRef> encoder_keys(
+ 1, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder);
+ std::vector<CFTypeRef> encoder_values(1, kCFBooleanTrue);
base::ScopedCFTypeRef<CFDictionaryRef> encoder_spec =
video_toolbox::DictionaryWithKeysAndValues(
encoder_keys.data(), encoder_values.data(), encoder_keys.size());
@@ -512,7 +486,8 @@
// are guaranteed that the output callback will not execute again.
OSStatus status = VTCompressionSessionCreate(
kCFAllocatorDefault, input_size.width(), input_size.height(),
- kCMVideoCodecType_H264, encoder_spec, attributes,
+ kCMVideoCodecType_H264, encoder_spec,
+ nullptr /* sourceImageBufferAttributes */,
nullptr /* compressedDataAllocator */,
&VTVideoEncodeAccelerator::CompressionCallback,
reinterpret_cast<void*>(this), compression_session_.InitializeInto());
@@ -520,8 +495,8 @@
DLOG(ERROR) << " VTCompressionSessionCreate failed: " << status;
return false;
}
- DVLOG(3) << " VTCompressionSession created with HW encode: "
- << require_hw_encoding << ", input size=" << input_size.ToString();
+ DVLOG(3) << " VTCompressionSession created with input size="
+ << input_size.ToString();
return true;
}
@@ -542,6 +517,9 @@
kVTCompressionPropertyKey_MaxKeyFrameInterval, 7200);
rv &= session_property_setter.Set(
kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, 240);
+ rv &=
+ session_property_setter.Set(kVTCompressionPropertyKey_MaxFrameDelayCount,
+ static_cast<int>(kNumInputBuffers));
DLOG_IF(ERROR, !rv) << " Setting session property failed.";
return rv;
}
« no previous file with comments | « media/gpu/vt_video_encode_accelerator_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698