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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 RTC_DCHECK_RUN_ON(&encoder_queue_); | 534 RTC_DCHECK_RUN_ON(&encoder_queue_); |
535 const auto scaling_settings = settings_.encoder->GetScalingSettings(); | 535 const auto scaling_settings = settings_.encoder->GetScalingSettings(); |
536 const bool degradation_preference_allows_scaling = | 536 const bool degradation_preference_allows_scaling = |
537 degradation_preference_ == DegradationPreference::kMaintainFramerate || | 537 degradation_preference_ == DegradationPreference::kMaintainFramerate || |
538 degradation_preference_ == DegradationPreference::kBalanced; | 538 degradation_preference_ == DegradationPreference::kBalanced; |
539 const bool quality_scaling_allowed = | 539 const bool quality_scaling_allowed = |
540 degradation_preference_allows_scaling && scaling_settings.enabled; | 540 degradation_preference_allows_scaling && scaling_settings.enabled; |
541 | 541 |
542 const std::vector<int>& scale_counters = GetScaleCounters(); | 542 const std::vector<int>& scale_counters = GetScaleCounters(); |
543 stats_proxy_->SetCpuScalingStats( | 543 stats_proxy_->SetCpuScalingStats( |
544 degradation_preference_allows_scaling ? scale_counters[kCpu] > 0 : false); | 544 degradation_preference_allows_scaling ? scale_counters[kCpu] : -1); |
545 stats_proxy_->SetQualityScalingStats( | 545 stats_proxy_->SetQualityScalingStats( |
546 quality_scaling_allowed ? scale_counters[kQuality] : -1); | 546 quality_scaling_allowed ? scale_counters[kQuality] : -1); |
547 | 547 |
548 if (quality_scaling_allowed) { | 548 if (quality_scaling_allowed) { |
549 // Abort if quality scaler has already been configured. | 549 // Abort if quality scaler has already been configured. |
550 if (quality_scaler_.get() != nullptr) | 550 if (quality_scaler_.get() != nullptr) |
551 return; | 551 return; |
552 // Drop frames and scale down until desired quality is achieved. | 552 // Drop frames and scale down until desired quality is achieved. |
553 if (scaling_settings.thresholds) { | 553 if (scaling_settings.thresholds) { |
554 quality_scaler_.reset( | 554 quality_scaler_.reset( |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 void ViEEncoder::IncrementScaleCounter(int reason, int delta) { | 971 void ViEEncoder::IncrementScaleCounter(int reason, int delta) { |
972 // Get the counters and validate. This may also lazily initialize the state. | 972 // Get the counters and validate. This may also lazily initialize the state. |
973 const std::vector<int>& counter = GetScaleCounters(); | 973 const std::vector<int>& counter = GetScaleCounters(); |
974 if (delta < 0) { | 974 if (delta < 0) { |
975 RTC_DCHECK_GE(counter[reason], delta); | 975 RTC_DCHECK_GE(counter[reason], delta); |
976 } | 976 } |
977 scale_counters_[degradation_preference_][reason] += delta; | 977 scale_counters_[degradation_preference_][reason] += delta; |
978 } | 978 } |
979 | 979 |
980 } // namespace webrtc | 980 } // namespace webrtc |
OLD | NEW |