| OLD | NEW | 
|---|
| 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 | 
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 454       std::move(streams), encoder_config_.min_transmit_bitrate_bps); | 454       std::move(streams), encoder_config_.min_transmit_bitrate_bps); | 
| 455 | 455 | 
| 456   ConfigureQualityScaler(); | 456   ConfigureQualityScaler(); | 
| 457 } | 457 } | 
| 458 | 458 | 
| 459 void ViEEncoder::ConfigureQualityScaler() { | 459 void ViEEncoder::ConfigureQualityScaler() { | 
| 460   RTC_DCHECK_RUN_ON(&encoder_queue_); | 460   RTC_DCHECK_RUN_ON(&encoder_queue_); | 
| 461   const auto scaling_settings = settings_.encoder->GetScalingSettings(); | 461   const auto scaling_settings = settings_.encoder->GetScalingSettings(); | 
| 462   const bool degradation_preference_allows_scaling = | 462   const bool degradation_preference_allows_scaling = | 
| 463       degradation_preference_ != DegradationPreference::kMaintainResolution; | 463       degradation_preference_ != DegradationPreference::kMaintainResolution; | 
|  | 464   const bool quality_scaling_allowed = | 
|  | 465       degradation_preference_allows_scaling && scaling_settings.enabled; | 
| 464 | 466 | 
| 465   stats_proxy_->SetResolutionRestrictionStats( | 467   stats_proxy_->SetCpuScalingStats( | 
| 466       degradation_preference_allows_scaling, scale_counter_[kCpu] > 0, | 468       degradation_preference_allows_scaling ? scale_counter_[kCpu] > 0 : false); | 
| 467       scale_counter_[kQuality]); | 469   stats_proxy_->SetQualityScalingStats( | 
|  | 470       quality_scaling_allowed ? scale_counter_[kQuality] : -1); | 
| 468 | 471 | 
| 469   if (degradation_preference_allows_scaling && | 472   if (quality_scaling_allowed) { | 
| 470       scaling_settings.enabled) { |  | 
| 471     // Abort if quality scaler has already been configured. | 473     // Abort if quality scaler has already been configured. | 
| 472     if (quality_scaler_.get() != nullptr) | 474     if (quality_scaler_.get() != nullptr) | 
| 473       return; | 475       return; | 
| 474     // Drop frames and scale down until desired quality is achieved. | 476     // Drop frames and scale down until desired quality is achieved. | 
| 475     if (scaling_settings.thresholds) { | 477     if (scaling_settings.thresholds) { | 
| 476       quality_scaler_.reset( | 478       quality_scaler_.reset( | 
| 477           new QualityScaler(this, *(scaling_settings.thresholds))); | 479           new QualityScaler(this, *(scaling_settings.thresholds))); | 
| 478     } else { | 480     } else { | 
| 479       quality_scaler_.reset(new QualityScaler(this, codec_type_)); | 481       quality_scaler_.reset(new QualityScaler(this, codec_type_)); | 
| 480     } | 482     } | 
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 779   --scale_counter_[reason]; | 781   --scale_counter_[reason]; | 
| 780   source_proxy_->RequestHigherResolutionThan(current_pixel_count); | 782   source_proxy_->RequestHigherResolutionThan(current_pixel_count); | 
| 781   LOG(LS_INFO) << "Scaling up resolution."; | 783   LOG(LS_INFO) << "Scaling up resolution."; | 
| 782   for (size_t i = 0; i < kScaleReasonSize; ++i) { | 784   for (size_t i = 0; i < kScaleReasonSize; ++i) { | 
| 783     LOG(LS_INFO) << "Scaled " << scale_counter_[i] | 785     LOG(LS_INFO) << "Scaled " << scale_counter_[i] | 
| 784                  << " times for reason: " << (i ? "cpu" : "quality"); | 786                  << " times for reason: " << (i ? "cpu" : "quality"); | 
| 785   } | 787   } | 
| 786 } | 788 } | 
| 787 | 789 | 
| 788 }  // namespace webrtc | 790 }  // namespace webrtc | 
| OLD | NEW | 
|---|