Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Side by Side Diff: webrtc/video/vie_encoder.cc

Issue 2652893015: Rename adaptation api methods, extended vie_encoder unit test. (Closed)
Patch Set: Rebase, again Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 #include "webrtc/video/vie_encoder.h" 11 #include "webrtc/video/vie_encoder.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <limits> 14 #include <limits>
15 #include <utility> 15 #include <utility>
16 16
17 #include "webrtc/modules/video_coding/include/video_codec_initializer.h"
18 #include "webrtc/base/arraysize.h" 17 #include "webrtc/base/arraysize.h"
19 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
20 #include "webrtc/base/logging.h" 19 #include "webrtc/base/logging.h"
21 #include "webrtc/base/trace_event.h" 20 #include "webrtc/base/trace_event.h"
22 #include "webrtc/base/timeutils.h" 21 #include "webrtc/base/timeutils.h"
23 #include "webrtc/common_video/include/video_bitrate_allocator.h" 22 #include "webrtc/common_video/include/video_bitrate_allocator.h"
24 #include "webrtc/modules/pacing/paced_sender.h" 23 #include "webrtc/modules/pacing/paced_sender.h"
25 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 24 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
25 #include "webrtc/modules/video_coding/include/video_codec_initializer.h"
26 #include "webrtc/modules/video_coding/include/video_coding.h" 26 #include "webrtc/modules/video_coding/include/video_coding.h"
27 #include "webrtc/modules/video_coding/include/video_coding_defines.h" 27 #include "webrtc/modules/video_coding/include/video_coding_defines.h"
28 #include "webrtc/video/overuse_frame_detector.h" 28 #include "webrtc/video/overuse_frame_detector.h"
29 #include "webrtc/video/send_statistics_proxy.h" 29 #include "webrtc/video/send_statistics_proxy.h"
30 #include "webrtc/video_frame.h" 30 #include "webrtc/video_frame.h"
31 namespace webrtc { 31 namespace webrtc {
32 32
33 namespace { 33 namespace {
34 using DegradationPreference = VideoSendStream::DegradationPreference;
35
34 // Time interval for logging frame counts. 36 // Time interval for logging frame counts.
35 const int64_t kFrameLogIntervalMs = 60000; 37 const int64_t kFrameLogIntervalMs = 60000;
36 // We will never ask for a resolution lower than this. 38 // We will never ask for a resolution lower than this.
37 #if defined(WEBRTC_ANDROID) 39 #if defined(WEBRTC_ANDROID)
38 // TODO(kthelgason): Lower this limit when better testing 40 // TODO(kthelgason): Lower this limit when better testing
39 // on MediaCodec and fallback implementations are in place. 41 // on MediaCodec and fallback implementations are in place.
40 const int kMinPixelsPerFrame = 320 * 180; 42 const int kMinPixelsPerFrame = 320 * 180;
41 #else 43 #else
42 const int kMinPixelsPerFrame = 120 * 90; 44 const int kMinPixelsPerFrame = 120 * 90;
43 #endif 45 #endif
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 }; 129 };
128 130
129 // VideoSourceProxy is responsible ensuring thread safety between calls to 131 // VideoSourceProxy is responsible ensuring thread safety between calls to
130 // ViEEncoder::SetSource that will happen on libjingle's worker thread when a 132 // ViEEncoder::SetSource that will happen on libjingle's worker thread when a
131 // video capturer is connected to the encoder and the encoder task queue 133 // video capturer is connected to the encoder and the encoder task queue
132 // (encoder_queue_) where the encoder reports its VideoSinkWants. 134 // (encoder_queue_) where the encoder reports its VideoSinkWants.
133 class ViEEncoder::VideoSourceProxy { 135 class ViEEncoder::VideoSourceProxy {
134 public: 136 public:
135 explicit VideoSourceProxy(ViEEncoder* vie_encoder) 137 explicit VideoSourceProxy(ViEEncoder* vie_encoder)
136 : vie_encoder_(vie_encoder), 138 : vie_encoder_(vie_encoder),
137 degradation_preference_( 139 degradation_preference_(DegradationPreference::kMaintainResolution),
138 VideoSendStream::DegradationPreference::kMaintainResolution),
139 source_(nullptr) {} 140 source_(nullptr) {}
140 141
141 void SetSource( 142 void SetSource(rtc::VideoSourceInterface<VideoFrame>* source,
142 rtc::VideoSourceInterface<VideoFrame>* source, 143 const DegradationPreference& degradation_preference) {
143 const VideoSendStream::DegradationPreference& degradation_preference) {
144 // Called on libjingle's worker thread. 144 // Called on libjingle's worker thread.
145 RTC_DCHECK_CALLED_SEQUENTIALLY(&main_checker_); 145 RTC_DCHECK_CALLED_SEQUENTIALLY(&main_checker_);
146 rtc::VideoSourceInterface<VideoFrame>* old_source = nullptr; 146 rtc::VideoSourceInterface<VideoFrame>* old_source = nullptr;
147 rtc::VideoSinkWants wants; 147 rtc::VideoSinkWants wants;
148 { 148 {
149 rtc::CritScope lock(&crit_); 149 rtc::CritScope lock(&crit_);
150 old_source = source_; 150 old_source = source_;
151 source_ = source; 151 source_ = source;
152 degradation_preference_ = degradation_preference; 152 degradation_preference_ = degradation_preference;
153 wants = current_wants(); 153 wants = current_wants();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 sink_wants_.max_pixel_count_step_up = rtc::Optional<int>(); 192 sink_wants_.max_pixel_count_step_up = rtc::Optional<int>();
193 if (source_) 193 if (source_)
194 source_->AddOrUpdateSink(vie_encoder_, sink_wants_); 194 source_->AddOrUpdateSink(vie_encoder_, sink_wants_);
195 } 195 }
196 196
197 void RequestHigherResolutionThan(int pixel_count) { 197 void RequestHigherResolutionThan(int pixel_count) {
198 rtc::CritScope lock(&crit_); 198 rtc::CritScope lock(&crit_);
199 if (!IsResolutionScalingEnabledLocked()) { 199 if (!IsResolutionScalingEnabledLocked()) {
200 // This can happen since |degradation_preference_| is set on 200 // This can happen since |degradation_preference_| is set on
201 // libjingle's worker thread but the adaptation is done on the encoder 201 // libjingle's worker thread but the adaptation is done on the encoder
202 // task 202 // task queue.
203 // queue.
204 return; 203 return;
205 } 204 }
206 // The input video frame size will have a resolution with "one step up" 205 // The input video frame size will have a resolution with "one step up"
207 // pixels than |max_pixel_count_step_up| where "one step up" depends on 206 // pixels than |max_pixel_count_step_up| where "one step up" depends on
208 // how the source can scale the input frame size. 207 // how the source can scale the input frame size.
209 sink_wants_.max_pixel_count = rtc::Optional<int>(); 208 sink_wants_.max_pixel_count = rtc::Optional<int>();
210 sink_wants_.max_pixel_count_step_up = rtc::Optional<int>(pixel_count); 209 sink_wants_.max_pixel_count_step_up = rtc::Optional<int>(pixel_count);
211 if (source_) 210 if (source_)
212 source_->AddOrUpdateSink(vie_encoder_, sink_wants_); 211 source_->AddOrUpdateSink(vie_encoder_, sink_wants_);
213 } 212 }
214 213
215 private: 214 private:
216 bool IsResolutionScalingEnabledLocked() const 215 bool IsResolutionScalingEnabledLocked() const
217 EXCLUSIVE_LOCKS_REQUIRED(&crit_) { 216 EXCLUSIVE_LOCKS_REQUIRED(&crit_) {
218 return degradation_preference_ != 217 return degradation_preference_ !=
219 VideoSendStream::DegradationPreference::kMaintainResolution; 218 DegradationPreference::kMaintainResolution;
220 } 219 }
221 220
222 const rtc::VideoSinkWants& current_wants() const 221 const rtc::VideoSinkWants& current_wants() const
223 EXCLUSIVE_LOCKS_REQUIRED(&crit_) { 222 EXCLUSIVE_LOCKS_REQUIRED(&crit_) {
224 return IsResolutionScalingEnabledLocked() ? sink_wants_ 223 return IsResolutionScalingEnabledLocked() ? sink_wants_
225 : disabled_scaling_sink_wants_; 224 : disabled_scaling_sink_wants_;
226 } 225 }
227 226
228 rtc::CriticalSection crit_; 227 rtc::CriticalSection crit_;
229 rtc::SequencedTaskChecker main_checker_; 228 rtc::SequencedTaskChecker main_checker_;
230 ViEEncoder* const vie_encoder_; 229 ViEEncoder* const vie_encoder_;
231 rtc::VideoSinkWants sink_wants_ GUARDED_BY(&crit_); 230 rtc::VideoSinkWants sink_wants_ GUARDED_BY(&crit_);
232 rtc::VideoSinkWants disabled_scaling_sink_wants_ GUARDED_BY(&crit_); 231 rtc::VideoSinkWants disabled_scaling_sink_wants_ GUARDED_BY(&crit_);
233 VideoSendStream::DegradationPreference degradation_preference_ 232 DegradationPreference degradation_preference_ GUARDED_BY(&crit_);
234 GUARDED_BY(&crit_);
235 rtc::VideoSourceInterface<VideoFrame>* source_ GUARDED_BY(&crit_); 233 rtc::VideoSourceInterface<VideoFrame>* source_ GUARDED_BY(&crit_);
236 234
237 RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy); 235 RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy);
238 }; 236 };
239 237
240 ViEEncoder::ViEEncoder(uint32_t number_of_cores, 238 ViEEncoder::ViEEncoder(uint32_t number_of_cores,
241 SendStatisticsProxy* stats_proxy, 239 SendStatisticsProxy* stats_proxy,
242 const VideoSendStream::Config::EncoderSettings& settings, 240 const VideoSendStream::Config::EncoderSettings& settings,
243 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, 241 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback,
244 EncodedFrameObserver* encoder_timing) 242 EncodedFrameObserver* encoder_timing)
(...skipping 17 matching lines...) Expand all
262 max_data_payload_length_(0), 260 max_data_payload_length_(0),
263 nack_enabled_(false), 261 nack_enabled_(false),
264 last_observed_bitrate_bps_(0), 262 last_observed_bitrate_bps_(0),
265 encoder_paused_and_dropped_frame_(false), 263 encoder_paused_and_dropped_frame_(false),
266 has_received_sli_(false), 264 has_received_sli_(false),
267 picture_id_sli_(0), 265 picture_id_sli_(0),
268 has_received_rpsi_(false), 266 has_received_rpsi_(false),
269 picture_id_rpsi_(0), 267 picture_id_rpsi_(0),
270 clock_(Clock::GetRealTimeClock()), 268 clock_(Clock::GetRealTimeClock()),
271 scale_counter_(kScaleReasonSize, 0), 269 scale_counter_(kScaleReasonSize, 0),
270 degradation_preference_(DegradationPreference::kMaintainResolution),
272 last_captured_timestamp_(0), 271 last_captured_timestamp_(0),
273 delta_ntp_internal_ms_(clock_->CurrentNtpInMilliseconds() - 272 delta_ntp_internal_ms_(clock_->CurrentNtpInMilliseconds() -
274 clock_->TimeInMilliseconds()), 273 clock_->TimeInMilliseconds()),
275 last_frame_log_ms_(clock_->TimeInMilliseconds()), 274 last_frame_log_ms_(clock_->TimeInMilliseconds()),
276 captured_frame_count_(0), 275 captured_frame_count_(0),
277 dropped_frame_count_(0), 276 dropped_frame_count_(0),
278 bitrate_observer_(nullptr), 277 bitrate_observer_(nullptr),
279 encoder_queue_("EncoderQueue") { 278 encoder_queue_("EncoderQueue") {
280 encoder_queue_.PostTask([this] { 279 encoder_queue_.PostTask([this] {
281 RTC_DCHECK_RUN_ON(&encoder_queue_); 280 RTC_DCHECK_RUN_ON(&encoder_queue_);
282 overuse_detector_.StartCheckForOveruse(); 281 overuse_detector_.StartCheckForOveruse();
283 video_sender_.RegisterExternalEncoder( 282 video_sender_.RegisterExternalEncoder(
284 settings_.encoder, settings_.payload_type, settings_.internal_source); 283 settings_.encoder, settings_.payload_type, settings_.internal_source);
285 }); 284 });
286 } 285 }
287 286
288 ViEEncoder::~ViEEncoder() { 287 ViEEncoder::~ViEEncoder() {
289 RTC_DCHECK_RUN_ON(&thread_checker_); 288 RTC_DCHECK_RUN_ON(&thread_checker_);
290 RTC_DCHECK(shutdown_event_.Wait(0)) 289 RTC_DCHECK(shutdown_event_.Wait(0))
291 << "Must call ::Stop() before destruction."; 290 << "Must call ::Stop() before destruction.";
292 } 291 }
293 292
294 void ViEEncoder::Stop() { 293 void ViEEncoder::Stop() {
295 RTC_DCHECK_RUN_ON(&thread_checker_); 294 RTC_DCHECK_RUN_ON(&thread_checker_);
296 source_proxy_->SetSource(nullptr, VideoSendStream::DegradationPreference()); 295 source_proxy_->SetSource(nullptr, DegradationPreference());
297 encoder_queue_.PostTask([this] { 296 encoder_queue_.PostTask([this] {
298 RTC_DCHECK_RUN_ON(&encoder_queue_); 297 RTC_DCHECK_RUN_ON(&encoder_queue_);
299 overuse_detector_.StopCheckForOveruse(); 298 overuse_detector_.StopCheckForOveruse();
300 rate_allocator_.reset(); 299 rate_allocator_.reset();
301 bitrate_observer_ = nullptr; 300 bitrate_observer_ = nullptr;
302 video_sender_.RegisterExternalEncoder(nullptr, settings_.payload_type, 301 video_sender_.RegisterExternalEncoder(nullptr, settings_.payload_type,
303 false); 302 false);
304 quality_scaler_ = nullptr; 303 quality_scaler_ = nullptr;
305 shutdown_event_.Set(); 304 shutdown_event_.Set();
306 }); 305 });
(...skipping 24 matching lines...) Expand all
331 }); 330 });
332 } 331 }
333 332
334 void ViEEncoder::SetSource( 333 void ViEEncoder::SetSource(
335 rtc::VideoSourceInterface<VideoFrame>* source, 334 rtc::VideoSourceInterface<VideoFrame>* source,
336 const VideoSendStream::DegradationPreference& degradation_preference) { 335 const VideoSendStream::DegradationPreference& degradation_preference) {
337 RTC_DCHECK_RUN_ON(&thread_checker_); 336 RTC_DCHECK_RUN_ON(&thread_checker_);
338 source_proxy_->SetSource(source, degradation_preference); 337 source_proxy_->SetSource(source, degradation_preference);
339 encoder_queue_.PostTask([this, degradation_preference] { 338 encoder_queue_.PostTask([this, degradation_preference] {
340 RTC_DCHECK_RUN_ON(&encoder_queue_); 339 RTC_DCHECK_RUN_ON(&encoder_queue_);
341 scaling_enabled_ = (degradation_preference != 340
342 VideoSendStream::DegradationPreference::kMaintainResolution); 341 degradation_preference_ = degradation_preference;
343 stats_proxy_->SetResolutionRestrictionStats( 342 stats_proxy_->SetResolutionRestrictionStats(
344 scaling_enabled_, scale_counter_[kCpu] > 0, scale_counter_[kQuality]); 343 degradation_preference !=
344 VideoSendStream::DegradationPreference::kMaintainResolution,
345 scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
345 }); 346 });
346 } 347 }
347 348
348 void ViEEncoder::SetSink(EncoderSink* sink, bool rotation_applied) { 349 void ViEEncoder::SetSink(EncoderSink* sink, bool rotation_applied) {
349 source_proxy_->SetWantsRotationApplied(rotation_applied); 350 source_proxy_->SetWantsRotationApplied(rotation_applied);
350 encoder_queue_.PostTask([this, sink] { 351 encoder_queue_.PostTask([this, sink] {
351 RTC_DCHECK_RUN_ON(&encoder_queue_); 352 RTC_DCHECK_RUN_ON(&encoder_queue_);
352 sink_ = sink; 353 sink_ = sink;
353 }); 354 });
354 } 355 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 stats_proxy_->OnEncoderReconfigured( 431 stats_proxy_->OnEncoderReconfigured(
431 encoder_config_, rate_allocator_->GetPreferredBitrateBps(framerate)); 432 encoder_config_, rate_allocator_->GetPreferredBitrateBps(framerate));
432 } 433 }
433 434
434 pending_encoder_reconfiguration_ = false; 435 pending_encoder_reconfiguration_ = false;
435 436
436 sink_->OnEncoderConfigurationChanged( 437 sink_->OnEncoderConfigurationChanged(
437 std::move(streams), encoder_config_.min_transmit_bitrate_bps); 438 std::move(streams), encoder_config_.min_transmit_bitrate_bps);
438 439
439 const auto scaling_settings = settings_.encoder->GetScalingSettings(); 440 const auto scaling_settings = settings_.encoder->GetScalingSettings();
440 if (scaling_enabled_ && scaling_settings.enabled) { 441 if (degradation_preference_ != DegradationPreference::kMaintainResolution &&
442 scaling_settings.enabled) {
441 if (scaling_settings.thresholds) { 443 if (scaling_settings.thresholds) {
442 quality_scaler_.reset( 444 quality_scaler_.reset(
443 new QualityScaler(this, *(scaling_settings.thresholds))); 445 new QualityScaler(this, *(scaling_settings.thresholds)));
444 } else { 446 } else {
445 quality_scaler_.reset(new QualityScaler(this, codec_type_)); 447 quality_scaler_.reset(new QualityScaler(this, codec_type_));
446 } 448 }
447 } else { 449 } else {
448 quality_scaler_.reset(nullptr); 450 quality_scaler_.reset(nullptr);
449 stats_proxy_->SetResolutionRestrictionStats( 451 stats_proxy_->SetResolutionRestrictionStats(
450 false, scale_counter_[kCpu] > 0, scale_counter_[kQuality]); 452 false, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 bool video_suspension_changed = video_is_suspended != EncoderPaused(); 696 bool video_suspension_changed = video_is_suspended != EncoderPaused();
695 last_observed_bitrate_bps_ = bitrate_bps; 697 last_observed_bitrate_bps_ = bitrate_bps;
696 698
697 if (stats_proxy_ && video_suspension_changed) { 699 if (stats_proxy_ && video_suspension_changed) {
698 LOG(LS_INFO) << "Video suspend state changed to: " 700 LOG(LS_INFO) << "Video suspend state changed to: "
699 << (video_is_suspended ? "suspended" : "not suspended"); 701 << (video_is_suspended ? "suspended" : "not suspended");
700 stats_proxy_->OnSuspendChange(video_is_suspended); 702 stats_proxy_->OnSuspendChange(video_is_suspended);
701 } 703 }
702 } 704 }
703 705
704 void ViEEncoder::ScaleDown(ScaleReason reason) { 706 void ViEEncoder::AdaptDown(AdaptReason reason) {
705 RTC_DCHECK_RUN_ON(&encoder_queue_); 707 RTC_DCHECK_RUN_ON(&encoder_queue_);
706 if (!scaling_enabled_) 708 if (degradation_preference_ != DegradationPreference::kBalanced)
707 return; 709 return;
708 // Request lower resolution if the current resolution is lower than last time 710 // Request lower resolution if the current resolution is lower than last time
709 // we asked for the resolution to be lowered. 711 // we asked for the resolution to be lowered.
710 int current_pixel_count = 712 int current_pixel_count =
711 last_frame_info_ ? last_frame_info_->pixel_count() : 0; 713 last_frame_info_ ? last_frame_info_->pixel_count() : 0;
712 if (max_pixel_count_ && current_pixel_count >= *max_pixel_count_) 714 if (max_pixel_count_ && current_pixel_count >= *max_pixel_count_)
713 return; 715 return;
714 switch (reason) { 716 switch (reason) {
715 case kQuality: 717 case kQuality:
716 stats_proxy_->OnQualityRestrictedResolutionChanged( 718 stats_proxy_->OnQualityRestrictedResolutionChanged(
(...skipping 10 matching lines...) Expand all
727 max_pixel_count_step_up_ = rtc::Optional<int>(); 729 max_pixel_count_step_up_ = rtc::Optional<int>();
728 ++scale_counter_[reason]; 730 ++scale_counter_[reason];
729 source_proxy_->RequestResolutionLowerThan(current_pixel_count); 731 source_proxy_->RequestResolutionLowerThan(current_pixel_count);
730 LOG(LS_INFO) << "Scaling down resolution."; 732 LOG(LS_INFO) << "Scaling down resolution.";
731 for (size_t i = 0; i < kScaleReasonSize; ++i) { 733 for (size_t i = 0; i < kScaleReasonSize; ++i) {
732 LOG(LS_INFO) << "Scaled " << scale_counter_[i] 734 LOG(LS_INFO) << "Scaled " << scale_counter_[i]
733 << " times for reason: " << (i ? "cpu" : "quality"); 735 << " times for reason: " << (i ? "cpu" : "quality");
734 } 736 }
735 } 737 }
736 738
737 void ViEEncoder::ScaleUp(ScaleReason reason) { 739 void ViEEncoder::AdaptUp(AdaptReason reason) {
738 RTC_DCHECK_RUN_ON(&encoder_queue_); 740 RTC_DCHECK_RUN_ON(&encoder_queue_);
739 if (scale_counter_[reason] == 0 || !scaling_enabled_) 741 if (scale_counter_[reason] == 0 ||
742 degradation_preference_ != DegradationPreference::kBalanced) {
740 return; 743 return;
744 }
741 // Only scale if resolution is higher than last time 745 // Only scale if resolution is higher than last time
742 // we requested higher resolution. 746 // we requested higher resolution.
743 int current_pixel_count = 747 int current_pixel_count =
744 last_frame_info_ ? last_frame_info_->pixel_count() : 0; 748 last_frame_info_ ? last_frame_info_->pixel_count() : 0;
745 if (current_pixel_count <= max_pixel_count_step_up_.value_or(0)) 749 if (current_pixel_count <= max_pixel_count_step_up_.value_or(0))
746 return; 750 return;
747 switch (reason) { 751 switch (reason) {
748 case kQuality: 752 case kQuality:
749 stats_proxy_->OnQualityRestrictedResolutionChanged( 753 stats_proxy_->OnQualityRestrictedResolutionChanged(
750 scale_counter_[reason] - 1); 754 scale_counter_[reason] - 1);
751 break; 755 break;
752 case kCpu: 756 case kCpu:
753 // Update stats accordingly. 757 // Update stats accordingly.
754 stats_proxy_->OnCpuRestrictedResolutionChanged(scale_counter_[reason] > 758 stats_proxy_->OnCpuRestrictedResolutionChanged(scale_counter_[reason] >
755 1); 759 1);
756 break; 760 break;
757 } 761 }
758 max_pixel_count_ = rtc::Optional<int>(); 762 max_pixel_count_ = rtc::Optional<int>();
759 max_pixel_count_step_up_ = rtc::Optional<int>(current_pixel_count); 763 max_pixel_count_step_up_ = rtc::Optional<int>(current_pixel_count);
760 --scale_counter_[reason]; 764 --scale_counter_[reason];
761 source_proxy_->RequestHigherResolutionThan(current_pixel_count); 765 source_proxy_->RequestHigherResolutionThan(current_pixel_count);
762 LOG(LS_INFO) << "Scaling up resolution."; 766 LOG(LS_INFO) << "Scaling up resolution.";
763 for (size_t i = 0; i < kScaleReasonSize; ++i) { 767 for (size_t i = 0; i < kScaleReasonSize; ++i) {
764 LOG(LS_INFO) << "Scaled " << scale_counter_[i] 768 LOG(LS_INFO) << "Scaled " << scale_counter_[i]
765 << " times for reason: " << (i ? "cpu" : "quality"); 769 << " times for reason: " << (i ? "cpu" : "quality");
766 } 770 }
767 } 771 }
768 772
769 } // namespace webrtc 773 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video/vie_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698