| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/gpu/vt_video_encode_accelerator_mac.h" | 5 #include "media/gpu/vt_video_encode_accelerator_mac.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "media/base/mac/video_frame_mac.h" | 10 #include "media/base/mac/video_frame_mac.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return profiles; | 116 return profiles; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool VTVideoEncodeAccelerator::Initialize(VideoPixelFormat format, | 119 bool VTVideoEncodeAccelerator::Initialize(VideoPixelFormat format, |
| 120 const gfx::Size& input_visible_size, | 120 const gfx::Size& input_visible_size, |
| 121 VideoCodecProfile output_profile, | 121 VideoCodecProfile output_profile, |
| 122 uint32_t initial_bitrate, | 122 uint32_t initial_bitrate, |
| 123 Client* client) { | 123 Client* client) { |
| 124 DVLOG(3) << __func__ << ": input_format=" << VideoPixelFormatToString(format) | 124 DVLOG(3) << __func__ << ": input_format=" << VideoPixelFormatToString(format) |
| 125 << ", input_visible_size=" << input_visible_size.ToString() | 125 << ", input_visible_size=" << input_visible_size.ToString() |
| 126 << ", output_profile=" << output_profile | 126 << ", output_profile=" << GetProfileName(output_profile) |
| 127 << ", initial_bitrate=" << initial_bitrate; | 127 << ", initial_bitrate=" << initial_bitrate; |
| 128 DCHECK(thread_checker_.CalledOnValidThread()); | 128 DCHECK(thread_checker_.CalledOnValidThread()); |
| 129 DCHECK(client); | 129 DCHECK(client); |
| 130 | 130 |
| 131 if (PIXEL_FORMAT_I420 != format) { | 131 if (PIXEL_FORMAT_I420 != format) { |
| 132 DLOG(ERROR) << "Input format not supported= " | 132 DLOG(ERROR) << "Input format not supported= " |
| 133 << VideoPixelFormatToString(format); | 133 << VideoPixelFormatToString(format); |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 if (H264PROFILE_BASELINE != output_profile) { | 136 if (H264PROFILE_BASELINE != output_profile) { |
| 137 DLOG(ERROR) << "Output profile not supported= " << output_profile; | 137 DLOG(ERROR) << "Output profile not supported= " |
| 138 << GetProfileName(output_profile); |
| 138 return false; | 139 return false; |
| 139 } | 140 } |
| 140 | 141 |
| 141 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 142 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
| 142 client_ = client_ptr_factory_->GetWeakPtr(); | 143 client_ = client_ptr_factory_->GetWeakPtr(); |
| 143 input_visible_size_ = input_visible_size; | 144 input_visible_size_ = input_visible_size; |
| 144 frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator; | 145 frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator; |
| 145 initial_bitrate_ = initial_bitrate; | 146 initial_bitrate_ = initial_bitrate; |
| 146 bitstream_buffer_size_ = input_visible_size.GetArea(); | 147 bitstream_buffer_size_ = input_visible_size.GetArea(); |
| 147 | 148 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 (encoder_thread_.IsRunning() && | 550 (encoder_thread_.IsRunning() && |
| 550 encoder_thread_task_runner_->BelongsToCurrentThread())); | 551 encoder_thread_task_runner_->BelongsToCurrentThread())); |
| 551 | 552 |
| 552 if (compression_session_) { | 553 if (compression_session_) { |
| 553 VTCompressionSessionInvalidate(compression_session_); | 554 VTCompressionSessionInvalidate(compression_session_); |
| 554 compression_session_.reset(); | 555 compression_session_.reset(); |
| 555 } | 556 } |
| 556 } | 557 } |
| 557 | 558 |
| 558 } // namespace media | 559 } // namespace media |
| OLD | NEW |