Index: webrtc/video/send_statistics_proxy.cc |
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc |
index be58e3ed3d8b687c7597fb38761c492e454d714a..511fc2d5fd99cf87dead5f5c242be10ee439fde1 100644 |
--- a/webrtc/video/send_statistics_proxy.cc |
+++ b/webrtc/video/send_statistics_proxy.cc |
@@ -132,9 +132,8 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( |
const VideoSendStream::Stats& current_stats) { |
RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); |
const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; |
- const int kMinRequiredSamples = 200; |
- int in_width = input_width_counter_.Avg(kMinRequiredSamples); |
- int in_height = input_height_counter_.Avg(kMinRequiredSamples); |
+ int in_width = input_width_counter_.Avg(kMinRequiredUMASamples); |
+ int in_height = input_height_counter_.Avg(kMinRequiredUMASamples); |
int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); |
if (in_width != -1) { |
RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "InputWidthInPixels", |
@@ -144,8 +143,8 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( |
RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "InputFramesPerSecond", |
in_fps); |
} |
- int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); |
- int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); |
+ int sent_width = sent_width_counter_.Avg(kMinRequiredUMASamples); |
+ int sent_height = sent_height_counter_.Avg(kMinRequiredUMASamples); |
int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); |
if (sent_width != -1) { |
RTC_HISTOGRAMS_COUNTS_10000(kIndex, uma_prefix_ + "SentWidthInPixels", |
@@ -155,54 +154,60 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( |
RTC_HISTOGRAMS_COUNTS_100(kIndex, uma_prefix_ + "SentFramesPerSecond", |
sent_fps); |
} |
- int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); |
+ int encode_ms = encode_time_counter_.Avg(kMinRequiredUMASamples); |
if (encode_ms != -1) { |
RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs", |
encode_ms); |
} |
- int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); |
+ int key_frames_permille = key_frame_counter_.Permille(kMinRequiredUMASamples); |
if (key_frames_permille != -1) { |
RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "KeyFramesSentInPermille", |
key_frames_permille); |
} |
int quality_limited = |
- quality_limited_frame_counter_.Percent(kMinRequiredSamples); |
+ quality_limited_frame_counter_.Percent(kMinRequiredUMASamples); |
if (quality_limited != -1) { |
RTC_HISTOGRAMS_PERCENTAGE(kIndex, |
uma_prefix_ + "QualityLimitedResolutionInPercent", |
quality_limited); |
} |
- int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); |
+ int downscales = quality_downscales_counter_.Avg(kMinRequiredUMASamples); |
if (downscales != -1) { |
RTC_HISTOGRAMS_ENUMERATION( |
kIndex, uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, |
20); |
} |
- int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); |
+ int cpu_limited = cpu_limited_frame_counter_.Percent(kMinRequiredUMASamples); |
+ if (cpu_limited != -1) { |
+ RTC_HISTOGRAMS_PERCENTAGE( |
+ kIndex, uma_prefix_ + "CpuLimitedResolutionInPercent", cpu_limited); |
+ } |
+ int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredUMASamples); |
if (bw_limited != -1) { |
RTC_HISTOGRAMS_PERCENTAGE( |
kIndex, uma_prefix_ + "BandwidthLimitedResolutionInPercent", |
bw_limited); |
} |
- int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); |
+ int num_disabled = |
+ bw_resolutions_disabled_counter_.Avg(kMinRequiredUMASamples); |
if (num_disabled != -1) { |
RTC_HISTOGRAMS_ENUMERATION( |
kIndex, uma_prefix_ + "BandwidthLimitedResolutionsDisabled", |
num_disabled, 10); |
} |
- int delay_ms = delay_counter_.Avg(kMinRequiredSamples); |
+ int delay_ms = delay_counter_.Avg(kMinRequiredUMASamples); |
if (delay_ms != -1) |
RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", |
delay_ms); |
- int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); |
+ int max_delay_ms = max_delay_counter_.Avg(kMinRequiredUMASamples); |
if (max_delay_ms != -1) { |
RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", |
max_delay_ms); |
} |
for (const auto& it : qp_counters_) { |
- int qp_vp8 = it.second.vp8.Avg(kMinRequiredSamples); |
+ int qp_vp8 = it.second.vp8.Avg(kMinRequiredUMASamples); |
if (qp_vp8 != -1) { |
int spatial_idx = it.first; |
if (spatial_idx == -1) { |
@@ -222,7 +227,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( |
<< spatial_idx; |
} |
} |
- int qp_vp9 = it.second.vp9.Avg(kMinRequiredSamples); |
+ int qp_vp9 = it.second.vp9.Avg(kMinRequiredUMASamples); |
if (qp_vp9 != -1) { |
int spatial_idx = it.first; |
if (spatial_idx == -1) { |
@@ -535,11 +540,27 @@ int SendStatisticsProxy::GetSendFrameRate() const { |
return stats_.encode_frame_rate; |
} |
-void SendStatisticsProxy::OnIncomingFrame(int width, int height) { |
+void SendStatisticsProxy::OnIncomingFrame(int width, |
+ int height, |
+ bool is_cpu_restricted) { |
rtc::CritScope lock(&crit_); |
uma_container_->input_frame_rate_tracker_.AddSamples(1); |
uma_container_->input_width_counter_.Add(width); |
uma_container_->input_height_counter_.Add(height); |
+ uma_container_->cpu_limited_frame_counter_.Add(is_cpu_restricted); |
+} |
+ |
+void SendStatisticsProxy::SetCpuRestrictedResolution( |
+ bool cpu_restricted_resolution) { |
+ rtc::CritScope lock(&crit_); |
+ stats_.cpu_limited_resolution = cpu_restricted_resolution; |
+} |
+ |
+void SendStatisticsProxy::OnCpuRestrictedResolutionChanged( |
+ bool cpu_restricted_resolution) { |
+ rtc::CritScope lock(&crit_); |
+ stats_.cpu_limited_resolution = cpu_restricted_resolution; |
+ ++stats_.number_of_cpu_adapt_changes; |
} |
void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |