| Index: media/gpu/vt_video_encode_accelerator_mac.cc
|
| diff --git a/content/common/gpu/media/vt_video_encode_accelerator_mac.cc b/media/gpu/vt_video_encode_accelerator_mac.cc
|
| similarity index 93%
|
| rename from content/common/gpu/media/vt_video_encode_accelerator_mac.cc
|
| rename to media/gpu/vt_video_encode_accelerator_mac.cc
|
| index d48b92d50d441c70261cc94ba9f8dc04b8fe1680..f9fadaf26652e3363508d7f680e294cf4fec93d7 100644
|
| --- a/content/common/gpu/media/vt_video_encode_accelerator_mac.cc
|
| +++ b/media/gpu/vt_video_encode_accelerator_mac.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/common/gpu/media/vt_video_encode_accelerator_mac.h"
|
| +#include "media/gpu/vt_video_encode_accelerator_mac.h"
|
|
|
| #include <memory>
|
|
|
| @@ -11,7 +11,7 @@
|
| #include "media/base/mac/corevideo_glue.h"
|
| #include "media/base/mac/video_frame_mac.h"
|
|
|
| -namespace content {
|
| +namespace media {
|
|
|
| namespace {
|
|
|
| @@ -30,8 +30,7 @@ const size_t kNumInputBuffers = 3;
|
| } // namespace
|
|
|
| struct VTVideoEncodeAccelerator::InProgressFrameEncode {
|
| - InProgressFrameEncode(base::TimeDelta rtp_timestamp,
|
| - base::TimeTicks ref_time)
|
| + InProgressFrameEncode(base::TimeDelta rtp_timestamp, base::TimeTicks ref_time)
|
| : timestamp(rtp_timestamp), reference_time(ref_time) {}
|
| const base::TimeDelta timestamp;
|
| const base::TimeTicks reference_time;
|
| @@ -130,8 +129,7 @@ bool VTVideoEncodeAccelerator::Initialize(
|
| return false;
|
| }
|
| if (media::H264PROFILE_BASELINE != output_profile) {
|
| - DLOG(ERROR) << "Output profile not supported= "
|
| - << output_profile;
|
| + DLOG(ERROR) << "Output profile not supported= " << output_profile;
|
| return false;
|
| }
|
|
|
| @@ -228,9 +226,8 @@ void VTVideoEncodeAccelerator::Destroy() {
|
|
|
| if (encoder_thread_.IsRunning()) {
|
| encoder_thread_task_runner_->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&VTVideoEncodeAccelerator::DestroyTask,
|
| - base::Unretained(this)));
|
| + FROM_HERE, base::Bind(&VTVideoEncodeAccelerator::DestroyTask,
|
| + base::Unretained(this)));
|
| encoder_thread_.Stop();
|
| } else {
|
| DestroyTask();
|
| @@ -416,9 +413,8 @@ void VTVideoEncodeAccelerator::ReturnBitstreamBuffer(
|
| CoreMediaGlue::CMSampleBufferGetSampleAttachmentsArray(
|
| encode_output->sample_buffer.get(), true),
|
| 0));
|
| - const bool keyframe =
|
| - !CFDictionaryContainsKey(sample_attachments,
|
| - CoreMediaGlue::kCMSampleAttachmentKey_NotSync());
|
| + const bool keyframe = !CFDictionaryContainsKey(
|
| + sample_attachments, CoreMediaGlue::kCMSampleAttachmentKey_NotSync());
|
|
|
| size_t used_buffer_size = 0;
|
| const bool copy_rv = media::video_toolbox::CopySampleBufferToAnnexBBuffer(
|
| @@ -439,11 +435,9 @@ bool VTVideoEncodeAccelerator::ResetCompressionSession() {
|
|
|
| DestroyCompressionSession();
|
|
|
| - CFTypeRef attributes_keys[] = {
|
| - kCVPixelBufferOpenGLCompatibilityKey,
|
| - kCVPixelBufferIOSurfacePropertiesKey,
|
| - kCVPixelBufferPixelFormatTypeKey
|
| - };
|
| + CFTypeRef attributes_keys[] = {kCVPixelBufferOpenGLCompatibilityKey,
|
| + kCVPixelBufferIOSurfacePropertiesKey,
|
| + kCVPixelBufferPixelFormatTypeKey};
|
| const int format[] = {
|
| CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange};
|
| CFTypeRef attributes_values[] = {
|
| @@ -480,12 +474,14 @@ bool VTVideoEncodeAccelerator::CreateCompressionSession(
|
| std::vector<CFTypeRef> encoder_keys;
|
| std::vector<CFTypeRef> encoder_values;
|
| if (require_hw_encoding) {
|
| - encoder_keys.push_back(videotoolbox_glue_
|
| - ->kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder());
|
| + encoder_keys.push_back(
|
| + videotoolbox_glue_
|
| + ->kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder());
|
| encoder_values.push_back(kCFBooleanTrue);
|
| } else {
|
| - encoder_keys.push_back(videotoolbox_glue_
|
| - ->kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder());
|
| + encoder_keys.push_back(
|
| + videotoolbox_glue_
|
| + ->kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder());
|
| encoder_values.push_back(kCFBooleanTrue);
|
| }
|
| base::ScopedCFTypeRef<CFDictionaryRef> encoder_spec =
|
| @@ -502,16 +498,11 @@ bool VTVideoEncodeAccelerator::CreateCompressionSession(
|
| // before returning to the client. Therefore, when control returns to us, we
|
| // are guaranteed that the output callback will not execute again.
|
| OSStatus status = videotoolbox_glue_->VTCompressionSessionCreate(
|
| - kCFAllocatorDefault,
|
| - input_size.width(),
|
| - input_size.height(),
|
| - CoreMediaGlue::kCMVideoCodecType_H264,
|
| - encoder_spec,
|
| - attributes,
|
| + kCFAllocatorDefault, input_size.width(), input_size.height(),
|
| + CoreMediaGlue::kCMVideoCodecType_H264, encoder_spec, attributes,
|
| nullptr /* compressedDataAllocator */,
|
| &VTVideoEncodeAccelerator::CompressionCallback,
|
| - reinterpret_cast<void*>(this),
|
| - compression_session_.InitializeInto());
|
| + reinterpret_cast<void*>(this), compression_session_.InitializeInto());
|
| if (status != noErr) {
|
| DLOG(ERROR) << " VTCompressionSessionCreate failed: " << status;
|
| return false;
|
| @@ -551,4 +542,4 @@ void VTVideoEncodeAccelerator::DestroyCompressionSession() {
|
| }
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace media
|
|
|