| 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 a3a65ba9784d67c798b5d6ff0a762b96fe9cec62..e38efd117b3e8dd7c473b2d757e0ce6da63f9177 100644
|
| --- a/media/gpu/vt_video_encode_accelerator_mac.cc
|
| +++ b/media/gpu/vt_video_encode_accelerator_mac.cc
|
| @@ -94,7 +94,7 @@ VTVideoEncodeAccelerator::~VTVideoEncodeAccelerator() {
|
| DCHECK(!encoder_task_weak_factory_.HasWeakPtrs());
|
| }
|
|
|
| -media::VideoEncodeAccelerator::SupportedProfiles
|
| +VideoEncodeAccelerator::SupportedProfiles
|
| VTVideoEncodeAccelerator::GetSupportedProfiles() {
|
| DVLOG(3) << __FUNCTION__;
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -112,7 +112,7 @@ VTVideoEncodeAccelerator::GetSupportedProfiles() {
|
| return profiles;
|
| }
|
| const bool rv = CreateCompressionSession(
|
| - media::video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0),
|
| + video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0),
|
| gfx::Size(kDefaultResolutionWidth, kDefaultResolutionHeight), true);
|
| DestroyCompressionSession();
|
| if (!rv) {
|
| @@ -122,7 +122,7 @@ VTVideoEncodeAccelerator::GetSupportedProfiles() {
|
| }
|
|
|
| SupportedProfile profile;
|
| - profile.profile = media::H264PROFILE_BASELINE;
|
| + profile.profile = H264PROFILE_BASELINE;
|
| profile.max_framerate_numerator = kMaxFrameRateNumerator;
|
| profile.max_framerate_denominator = kMaxFrameRateDenominator;
|
| profile.max_resolution = gfx::Size(kMaxResolutionWidth, kMaxResolutionHeight);
|
| @@ -130,26 +130,25 @@ VTVideoEncodeAccelerator::GetSupportedProfiles() {
|
| return profiles;
|
| }
|
|
|
| -bool VTVideoEncodeAccelerator::Initialize(
|
| - media::VideoPixelFormat format,
|
| - const gfx::Size& input_visible_size,
|
| - media::VideoCodecProfile output_profile,
|
| - uint32_t initial_bitrate,
|
| - Client* client) {
|
| +bool VTVideoEncodeAccelerator::Initialize(VideoPixelFormat format,
|
| + const gfx::Size& input_visible_size,
|
| + VideoCodecProfile output_profile,
|
| + uint32_t initial_bitrate,
|
| + Client* client) {
|
| DVLOG(3) << __FUNCTION__
|
| - << ": input_format=" << media::VideoPixelFormatToString(format)
|
| + << ": input_format=" << VideoPixelFormatToString(format)
|
| << ", input_visible_size=" << input_visible_size.ToString()
|
| << ", output_profile=" << output_profile
|
| << ", initial_bitrate=" << initial_bitrate;
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(client);
|
|
|
| - if (media::PIXEL_FORMAT_I420 != format) {
|
| + if (PIXEL_FORMAT_I420 != format) {
|
| DLOG(ERROR) << "Input format not supported= "
|
| - << media::VideoPixelFormatToString(format);
|
| + << VideoPixelFormatToString(format);
|
| return false;
|
| }
|
| - if (media::H264PROFILE_BASELINE != output_profile) {
|
| + if (H264PROFILE_BASELINE != output_profile) {
|
| DLOG(ERROR) << "Output profile not supported= " << output_profile;
|
| return false;
|
| }
|
| @@ -190,9 +189,8 @@ bool VTVideoEncodeAccelerator::Initialize(
|
| return true;
|
| }
|
|
|
| -void VTVideoEncodeAccelerator::Encode(
|
| - const scoped_refptr<media::VideoFrame>& frame,
|
| - bool force_keyframe) {
|
| +void VTVideoEncodeAccelerator::Encode(const scoped_refptr<VideoFrame>& frame,
|
| + bool force_keyframe) {
|
| DVLOG(3) << __FUNCTION__;
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| @@ -202,7 +200,7 @@ void VTVideoEncodeAccelerator::Encode(
|
| }
|
|
|
| void VTVideoEncodeAccelerator::UseOutputBitstreamBuffer(
|
| - const media::BitstreamBuffer& buffer) {
|
| + const BitstreamBuffer& buffer) {
|
| DVLOG(3) << __FUNCTION__ << ": buffer size=" << buffer.size();
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| @@ -261,7 +259,7 @@ void VTVideoEncodeAccelerator::Destroy() {
|
| }
|
|
|
| void VTVideoEncodeAccelerator::EncodeTask(
|
| - const scoped_refptr<media::VideoFrame>& frame,
|
| + const scoped_refptr<VideoFrame>& frame,
|
| bool force_keyframe) {
|
| DCHECK(encoder_thread_task_runner_->BelongsToCurrentThread());
|
| DCHECK(compression_session_);
|
| @@ -270,15 +268,15 @@ void VTVideoEncodeAccelerator::EncodeTask(
|
| // TODO(emircan): See if we can eliminate a copy here by using
|
| // CVPixelBufferPool for the allocation of incoming VideoFrames.
|
| base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer =
|
| - media::WrapVideoFrameInCVPixelBuffer(*frame);
|
| + WrapVideoFrameInCVPixelBuffer(*frame);
|
| base::ScopedCFTypeRef<CFDictionaryRef> frame_props =
|
| - media::video_toolbox::DictionaryWithKeyValue(
|
| + video_toolbox::DictionaryWithKeyValue(
|
| videotoolbox_glue_->kVTEncodeFrameOptionKey_ForceKeyFrame(),
|
| force_keyframe ? kCFBooleanTrue : kCFBooleanFalse);
|
|
|
| base::TimeTicks ref_time;
|
| - if (!frame->metadata()->GetTimeTicks(
|
| - media::VideoFrameMetadata::REFERENCE_TIME, &ref_time)) {
|
| + if (!frame->metadata()->GetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
|
| + &ref_time)) {
|
| ref_time = base::TimeTicks::Now();
|
| }
|
| auto timestamp_cm = CoreMediaGlue::CMTimeMake(
|
| @@ -332,7 +330,7 @@ void VTVideoEncodeAccelerator::RequestEncodingParametersChangeTask(
|
| }
|
|
|
| if (framerate != static_cast<uint32_t>(frame_rate_)) {
|
| - media::video_toolbox::SessionPropertySetter session_property_setter(
|
| + video_toolbox::SessionPropertySetter session_property_setter(
|
| compression_session_, videotoolbox_glue_);
|
| session_property_setter.Set(
|
| videotoolbox_glue_->kVTCompressionPropertyKey_ExpectedFrameRate(),
|
| @@ -353,14 +351,14 @@ void VTVideoEncodeAccelerator::SetAdjustedBitrate(int32_t bitrate) {
|
| return;
|
|
|
| encoder_set_bitrate_ = bitrate;
|
| - media::video_toolbox::SessionPropertySetter session_property_setter(
|
| + video_toolbox::SessionPropertySetter session_property_setter(
|
| compression_session_, videotoolbox_glue_);
|
| bool rv = session_property_setter.Set(
|
| videotoolbox_glue_->kVTCompressionPropertyKey_AverageBitRate(),
|
| encoder_set_bitrate_);
|
| rv &= session_property_setter.Set(
|
| videotoolbox_glue_->kVTCompressionPropertyKey_DataRateLimits(),
|
| - media::video_toolbox::ArrayWithIntegerAndFloat(
|
| + video_toolbox::ArrayWithIntegerAndFloat(
|
| encoder_set_bitrate_ / kBitsPerByte, 1.0f));
|
| DLOG_IF(ERROR, !rv)
|
| << "Couldn't change bitrate parameters of encode session.";
|
| @@ -379,7 +377,7 @@ void VTVideoEncodeAccelerator::DestroyTask() {
|
| }
|
|
|
| void VTVideoEncodeAccelerator::NotifyError(
|
| - media::VideoEncodeAccelerator::Error error) {
|
| + VideoEncodeAccelerator::Error error) {
|
| DCHECK(encoder_thread_task_runner_->BelongsToCurrentThread());
|
| client_task_runner_->PostTask(
|
| FROM_HERE, base::Bind(&Client::NotifyError, client_, error));
|
| @@ -462,7 +460,7 @@ void VTVideoEncodeAccelerator::ReturnBitstreamBuffer(
|
| sample_attachments, CoreMediaGlue::kCMSampleAttachmentKey_NotSync());
|
|
|
| size_t used_buffer_size = 0;
|
| - const bool copy_rv = media::video_toolbox::CopySampleBufferToAnnexBBuffer(
|
| + const bool copy_rv = video_toolbox::CopySampleBufferToAnnexBBuffer(
|
| encode_output->sample_buffer.get(), keyframe, buffer_ref->size,
|
| reinterpret_cast<char*>(buffer_ref->shm->memory()), &used_buffer_size);
|
| if (!copy_rv) {
|
| @@ -489,12 +487,10 @@ bool VTVideoEncodeAccelerator::ResetCompressionSession() {
|
| CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange};
|
| CFTypeRef attributes_values[] = {
|
| kCFBooleanTrue,
|
| - media::video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0)
|
| - .release(),
|
| - media::video_toolbox::ArrayWithIntegers(format, arraysize(format))
|
| - .release()};
|
| + video_toolbox::DictionaryWithKeysAndValues(nullptr, nullptr, 0).release(),
|
| + video_toolbox::ArrayWithIntegers(format, arraysize(format)).release()};
|
| const base::ScopedCFTypeRef<CFDictionaryRef> attributes =
|
| - media::video_toolbox::DictionaryWithKeysAndValues(
|
| + video_toolbox::DictionaryWithKeysAndValues(
|
| attributes_keys, attributes_values, arraysize(attributes_keys));
|
| for (auto& v : attributes_values)
|
| CFRelease(v);
|
| @@ -532,7 +528,7 @@ bool VTVideoEncodeAccelerator::CreateCompressionSession(
|
| encoder_values.push_back(kCFBooleanTrue);
|
| }
|
| base::ScopedCFTypeRef<CFDictionaryRef> encoder_spec =
|
| - media::video_toolbox::DictionaryWithKeysAndValues(
|
| + video_toolbox::DictionaryWithKeysAndValues(
|
| encoder_keys.data(), encoder_values.data(), encoder_keys.size());
|
|
|
| // Create the compression session.
|
| @@ -563,7 +559,7 @@ bool VTVideoEncodeAccelerator::ConfigureCompressionSession() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(compression_session_);
|
|
|
| - media::video_toolbox::SessionPropertySetter session_property_setter(
|
| + video_toolbox::SessionPropertySetter session_property_setter(
|
| compression_session_, videotoolbox_glue_);
|
| bool rv = true;
|
| rv &= session_property_setter.Set(
|
|
|