| 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 f22db0955afb04a96153802781e0c2a053a7197a..a210e177c483e89e8815f75fb37d0151ef1ad257 100644
|
| --- a/content/common/gpu/media/vt_video_encode_accelerator_mac.cc
|
| +++ b/media/gpu/vt_video_encode_accelerator_mac.cc
|
| @@ -2,14 +2,14 @@
|
| // 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 "base/thread_task_runner_handle.h"
|
| #include "media/base/mac/coremedia_glue.h"
|
| #include "media/base/mac/corevideo_glue.h"
|
| #include "media/base/mac/video_frame_mac.h"
|
|
|
| -namespace content {
|
| +namespace media {
|
|
|
| namespace {
|
|
|
| @@ -28,8 +28,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;
|
| @@ -128,8 +127,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;
|
| }
|
|
|
| @@ -226,9 +224,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();
|
| @@ -414,9 +411,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(
|
| @@ -437,11 +433,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[] = {
|
| @@ -478,12 +472,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 =
|
| @@ -500,16 +496,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;
|
| @@ -549,4 +540,4 @@ void VTVideoEncodeAccelerator::DestroyCompressionSession() {
|
| }
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace media
|
|
|