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

Unified Diff: webrtc/video/vie_encoder.cc

Issue 2564373002: Properly report number of quality downscales in stats. (Closed)
Patch Set: clarify check for initialized encoder in simulcast adapter Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_encoder.cc
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc
index de6b9a8a636ed91f912f5f50a802d9a15fadc2be..e22c34a5c9bef525c9ad9507df0a2ed5d1fd4228 100644
--- a/webrtc/video/vie_encoder.cc
+++ b/webrtc/video/vie_encoder.cc
@@ -15,6 +15,7 @@
#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"
@@ -262,6 +263,7 @@ ViEEncoder::ViEEncoder(uint32_t number_of_cores,
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),
@@ -333,12 +335,10 @@ void ViEEncoder::SetSource(
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_[kQuality] > 0,
- scaling_enabled_ && scale_counter_[kCpu] > 0);
+ scaling_enabled_, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
});
}
@@ -434,7 +434,8 @@ void ViEEncoder::ReconfigureEncoder() {
std::move(streams), encoder_config_.min_transmit_bitrate_bps);
const auto scaling_settings = settings_.encoder->GetScalingSettings();
- if (scaling_settings.enabled && scaling_enabled_) {
+ scaling_enabled_ &= scaling_settings.enabled;
+ if (scaling_enabled_) {
if (scaling_settings.thresholds) {
quality_scaler_.reset(
new QualityScaler(this, *(scaling_settings.thresholds)));
@@ -443,6 +444,8 @@ void ViEEncoder::ReconfigureEncoder() {
}
} else {
quality_scaler_.reset(nullptr);
+ stats_proxy_->SetResolutionRestrictionStats(
+ false, scale_counter_[kCpu] > 0, scale_counter_[kQuality]);
}
}
@@ -590,9 +593,8 @@ EncodedImageCallback::Result ViEEncoder::OnEncodedImage(
// 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);
@@ -701,7 +703,8 @@ void ViEEncoder::ScaleDown(ScaleReason reason) {
return;
switch (reason) {
case kQuality:
- stats_proxy_->OnQualityRestrictedResolutionChanged(true);
+ stats_proxy_->OnQualityRestrictedResolutionChanged(
+ scale_counter_[reason] + 1);
break;
case kCpu:
if (scale_counter_[reason] >= kMaxCpuDowngrades)
@@ -733,7 +736,7 @@ void ViEEncoder::ScaleUp(ScaleReason reason) {
switch (reason) {
case kQuality:
stats_proxy_->OnQualityRestrictedResolutionChanged(
- scale_counter_[reason] > 1);
+ scale_counter_[reason] - 1);
break;
case kCpu:
// Update stats accordingly.
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | webrtc/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698