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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 2564373002: Properly report number of quality downscales in stats. (Closed)
Patch Set: tests passing 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
Index: webrtc/video/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 82d7f0dc7593bf2cd694aa69d55d8b6e91572915..f92465b3df7e85f73df0027589d7fce49c527706 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -476,10 +476,12 @@ void SendStatisticsProxy::OnSendEncodedImage(
size_t simulcast_idx = 0;
rtc::CritScope lock(&crit_);
+ bool report_quality_scales = quality_downscales_ >= 0;
++stats_.frames_encoded;
if (codec_info) {
if (codec_info->codecType == kVideoCodecVP8) {
simulcast_idx = codec_info->codecSpecific.VP8.simulcastIdx;
+ report_quality_scales &= simulcast_idx == 0;
åsapersson 2016/12/16 14:45:14 Shouldn't this be decided from the ScalingSettings
kthelgason 2016/12/19 10:25:27 Yes, you're absolutely right, quality scaling is t
} else if (codec_info->codecType == kVideoCodecGeneric) {
simulcast_idx = codec_info->codecSpecific.generic.simulcast_idx;
}
@@ -506,17 +508,13 @@ void SendStatisticsProxy::OnSendEncodedImage(
uma_container_->key_frame_counter_.Add(encoded_image._frameType ==
kVideoFrameKey);
stats_.bw_limited_resolution =
- stats_.bw_limited_resolution ||
- encoded_image.adapt_reason_.bw_resolutions_disabled > 0;
-
- if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) {
- bool downscaled =
- encoded_image.adapt_reason_.quality_resolution_downscales > 0;
- uma_container_->quality_limited_frame_counter_.Add(downscaled);
- if (downscaled) {
- uma_container_->quality_downscales_counter_.Add(
- encoded_image.adapt_reason_.quality_resolution_downscales);
- }
+ encoded_image.adapt_reason_.bw_resolutions_disabled > 0 ||
+ quality_downscales_ > 0;
+
+ if (report_quality_scales) {
+ uma_container_->quality_limited_frame_counter_.Add(quality_downscales_ > 0);
+ if (quality_downscales_ > 0)
+ uma_container_->quality_downscales_counter_.Add(quality_downscales_);
}
if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) {
bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0;
@@ -587,11 +585,20 @@ void SendStatisticsProxy::OnIncomingFrame(int width, int height) {
uma_container_->cpu_limited_frame_counter_.Add(stats_.cpu_limited_resolution);
}
-void SendStatisticsProxy::SetResolutionRestrictionStats(bool bandwidth,
- bool cpu) {
+void SendStatisticsProxy::SetResolutionRestrictionStats(
+ bool scaling_enabled,
+ bool cpu_restricted,
+ int nr_of_quality_downscales) {
rtc::CritScope lock(&crit_);
- stats_.bw_limited_resolution = bandwidth;
- stats_.cpu_limited_resolution = cpu;
+ if (!scaling_enabled) {
+ stats_.bw_limited_resolution = false;
+ stats_.cpu_limited_resolution = false;
+ quality_downscales_ = -1;
+ } else {
+ quality_downscales_ = nr_of_quality_downscales;
+ stats_.bw_limited_resolution = quality_downscales_ > 0;
+ stats_.cpu_limited_resolution = cpu_restricted;
+ }
}
void SendStatisticsProxy::OnCpuRestrictedResolutionChanged(
@@ -602,10 +609,10 @@ void SendStatisticsProxy::OnCpuRestrictedResolutionChanged(
}
void SendStatisticsProxy::OnQualityRestrictedResolutionChanged(
- bool restricted) {
+ int nr_of_downscales) {
rtc::CritScope lock(&crit_);
- uma_container_->quality_downscales_counter_.Add(restricted);
- stats_.bw_limited_resolution = restricted;
+ quality_downscales_ = nr_of_downscales;
+ stats_.bw_limited_resolution = quality_downscales_ > 0;
}
void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(

Powered by Google App Engine
This is Rietveld 408576698