| 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;
|
| }
|
|
|