OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const rtc::scoped_refptr<VideoFrameBuffer>& frame) { | 180 const rtc::scoped_refptr<VideoFrameBuffer>& frame) { |
181 Resolution res = GetScaledResolution(); | 181 Resolution res = GetScaledResolution(); |
182 const int src_width = frame->width(); | 182 const int src_width = frame->width(); |
183 const int src_height = frame->height(); | 183 const int src_height = frame->height(); |
184 | 184 |
185 if (res.width == src_width && res.height == src_height) | 185 if (res.width == src_width && res.height == src_height) |
186 return frame; | 186 return frame; |
187 rtc::scoped_refptr<I420Buffer> scaled_buffer = | 187 rtc::scoped_refptr<I420Buffer> scaled_buffer = |
188 pool_.CreateBuffer(res.width, res.height); | 188 pool_.CreateBuffer(res.width, res.height); |
189 | 189 |
190 scaled_buffer->ScaleFrom(frame); | 190 scaled_buffer->ScaleFrom(*frame); |
191 | 191 |
192 return scaled_buffer; | 192 return scaled_buffer; |
193 } | 193 } |
194 | 194 |
195 void QualityScaler::UpdateTargetResolution(int width, int height) { | 195 void QualityScaler::UpdateTargetResolution(int width, int height) { |
196 if (width < kMinDownscaleDimension || height < kMinDownscaleDimension) { | 196 if (width < kMinDownscaleDimension || height < kMinDownscaleDimension) { |
197 maximum_shift_ = 0; | 197 maximum_shift_ = 0; |
198 } else { | 198 } else { |
199 maximum_shift_ = static_cast<int>( | 199 maximum_shift_ = static_cast<int>( |
200 log2(std::min(width, height) / kMinDownscaleDimension)); | 200 log2(std::min(width, height) / kMinDownscaleDimension)); |
201 } | 201 } |
202 target_res_ = Resolution{width, height}; | 202 target_res_ = Resolution{width, height}; |
203 } | 203 } |
204 | 204 |
205 void QualityScaler::ClearSamples() { | 205 void QualityScaler::ClearSamples() { |
206 framedrop_percent_.Reset(); | 206 framedrop_percent_.Reset(); |
207 average_qp_.Reset(); | 207 average_qp_.Reset(); |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 } // namespace webrtc | 211 } // namespace webrtc |
OLD | NEW |