| Index: webrtc/video/vie_encoder.cc
|
| diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc
|
| index e22c34a5c9bef525c9ad9507df0a2ed5d1fd4228..de6b9a8a636ed91f912f5f50a802d9a15fadc2be 100644
|
| --- a/webrtc/video/vie_encoder.cc
|
| +++ b/webrtc/video/vie_encoder.cc
|
| @@ -15,7 +15,6 @@
|
| #include <utility>
|
|
|
| #include "webrtc/modules/video_coding/include/video_codec_initializer.h"
|
| -#include "webrtc/base/arraysize.h"
|
| #include "webrtc/base/checks.h"
|
| #include "webrtc/base/logging.h"
|
| #include "webrtc/base/trace_event.h"
|
| @@ -263,7 +262,6 @@
|
| has_received_rpsi_(false),
|
| picture_id_rpsi_(0),
|
| clock_(Clock::GetRealTimeClock()),
|
| - scale_counter_(kScaleReasonSize, 0),
|
| last_frame_width_(0),
|
| last_frame_height_(0),
|
| last_captured_timestamp_(0),
|
| @@ -335,10 +333,12 @@
|
| source_proxy_->SetSource(source, degradation_preference);
|
| encoder_queue_.PostTask([this, degradation_preference] {
|
| RTC_DCHECK_RUN_ON(&encoder_queue_);
|
| - scaling_enabled_ = (degradation_preference !=
|
| + scaling_enabled_ =
|
| + (degradation_preference !=
|
| VideoSendStream::DegradationPreference::kMaintainResolution);
|
| stats_proxy_->SetResolutionRestrictionStats(
|
| - scaling_enabled_, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
|
| + scaling_enabled_ && scale_counter_[kQuality] > 0,
|
| + scaling_enabled_ && scale_counter_[kCpu] > 0);
|
| });
|
| }
|
|
|
| @@ -434,8 +434,7 @@
|
| std::move(streams), encoder_config_.min_transmit_bitrate_bps);
|
|
|
| const auto scaling_settings = settings_.encoder->GetScalingSettings();
|
| - scaling_enabled_ &= scaling_settings.enabled;
|
| - if (scaling_enabled_) {
|
| + if (scaling_settings.enabled && scaling_enabled_) {
|
| if (scaling_settings.thresholds) {
|
| quality_scaler_.reset(
|
| new QualityScaler(this, *(scaling_settings.thresholds)));
|
| @@ -444,8 +443,6 @@
|
| }
|
| } else {
|
| quality_scaler_.reset(nullptr);
|
| - stats_proxy_->SetResolutionRestrictionStats(
|
| - false, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
|
| }
|
| }
|
|
|
| @@ -593,8 +590,9 @@
|
| // Encoded is called on whatever thread the real encoder implementation run
|
| // on. In the case of hardware encoders, there might be several encoders
|
| // running in parallel on different threads.
|
| - if (stats_proxy_)
|
| + if (stats_proxy_) {
|
| stats_proxy_->OnSendEncodedImage(encoded_image, codec_specific_info);
|
| + }
|
|
|
| EncodedImageCallback::Result result =
|
| sink_->OnEncodedImage(encoded_image, codec_specific_info, fragmentation);
|
| @@ -703,8 +701,7 @@
|
| return;
|
| switch (reason) {
|
| case kQuality:
|
| - stats_proxy_->OnQualityRestrictedResolutionChanged(
|
| - scale_counter_[reason] + 1);
|
| + stats_proxy_->OnQualityRestrictedResolutionChanged(true);
|
| break;
|
| case kCpu:
|
| if (scale_counter_[reason] >= kMaxCpuDowngrades)
|
| @@ -736,7 +733,7 @@
|
| switch (reason) {
|
| case kQuality:
|
| stats_proxy_->OnQualityRestrictedResolutionChanged(
|
| - scale_counter_[reason] - 1);
|
| + scale_counter_[reason] > 1);
|
| break;
|
| case kCpu:
|
| // Update stats accordingly.
|
|
|