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

Unified Diff: media/gpu/vt_video_encode_accelerator_mac.cc

Issue 2790063003: Merge 58: Enforce MaxFrameDelayCount in VTVideoEncodeAccelerator and cleanups (Closed)
Patch Set: Created 3 years, 9 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 f5aff7e4c381930a28278b924844c62e7c518bc6..e5fee2e14de14936ac2962b420e2626b96ff4ce4 100644
--- a/media/gpu/vt_video_encode_accelerator_mac.cc
+++ b/media/gpu/vt_video_encode_accelerator_mac.cc
@@ -98,8 +98,7 @@ VTVideoEncodeAccelerator::GetSupportedProfiles() {
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)
@@ -452,22 +451,7 @@ bool VTVideoEncodeAccelerator::ResetCompressionSession() {
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;
@@ -480,22 +464,12 @@ bool VTVideoEncodeAccelerator::ResetCompressionSession() {
}
bool VTVideoEncodeAccelerator::CreateCompressionSession(
- base::ScopedCFTypeRef<CFDictionaryRef> attributes,
- const gfx::Size& input_size,
- bool require_hw_encoding) {
+ const gfx::Size& input_size) {
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);
- }
+ 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());
@@ -511,7 +485,8 @@ bool VTVideoEncodeAccelerator::CreateCompressionSession(
// 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());
@@ -519,8 +494,8 @@ bool VTVideoEncodeAccelerator::CreateCompressionSession(
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;
}
@@ -541,6 +516,9 @@ bool VTVideoEncodeAccelerator::ConfigureCompressionSession() {
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