Chromium Code Reviews| 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..eb2e2762c5656890006dac3aa35a037194e97fe3 100644 |
| --- a/webrtc/video/send_statistics_proxy.cc |
| +++ b/webrtc/video/send_statistics_proxy.cc |
| @@ -506,17 +506,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 (quality_downscales_ != -1) { |
| + 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 +583,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) { |
|
stefan-webrtc
2016/12/19 12:12:00
Either remove the negation by swapping the blocks,
kthelgason
2016/12/19 12:18:18
Done.
|
| + 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 +607,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( |