Index: webrtc/video/send_statistics_proxy.cc |
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc |
index 551b4b562a43904f6cfe1105d65455b2610126b9..3f27f62ec3500aebab9f025839e68f770243acca 100644 |
--- a/webrtc/video/send_statistics_proxy.cc |
+++ b/webrtc/video/send_statistics_proxy.cc |
@@ -62,6 +62,17 @@ void SendStatisticsProxy::UpdateHistograms() { |
int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); |
if (encode_ms != -1) |
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); |
+ |
+ int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); |
+ if (bw_limited != -1) { |
+ RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent", |
+ bw_limited); |
+ } |
+ int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); |
stefan-webrtc
2015/09/23 15:10:34
Same as in the other CL, is this average per frame
åsapersson
2015/09/24 08:23:45
Per frame.
If a frame has resolutions disabled, |b
|
+ if (num_disabled != -1) { |
+ RTC_HISTOGRAM_ENUMERATION( |
+ "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10); |
+ } |
} |
void SendStatisticsProxy::OutgoingRate(const int video_channel, |
@@ -162,6 +173,15 @@ void SendStatisticsProxy::OnSendEncodedImage( |
stats->height = encoded_image._encodedHeight; |
update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
+ if (encoded_image.adapt_reason_.bw_available) { |
+ bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
+ bw_limited_frame_counter_.Add(bw_limited); |
+ if (bw_limited) { |
+ bw_resolutions_disabled_counter_.Add( |
+ encoded_image.adapt_reason_.bw_resolutions_disabled); |
+ } |
+ } |
+ |
// TODO(asapersson): This is incorrect if simulcast layers are encoded on |
// different threads and there is no guarantee that one frame of all layers |
// are encoded before the next start. |
@@ -271,7 +291,19 @@ void SendStatisticsProxy::SampleCounter::Add(int sample) { |
int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
if (num_samples < min_required_samples || num_samples == 0) |
return -1; |
- return sum / num_samples; |
+ return (sum + (num_samples / 2)) / num_samples; |
} |
+void SendStatisticsProxy::BoolSampleCounter::Add(bool sample) { |
+ if (sample) |
+ ++sum; |
+ ++num_samples; |
+} |
+ |
+int SendStatisticsProxy::BoolSampleCounter::Percent( |
+ int min_required_samples) const { |
+ if (num_samples < min_required_samples || num_samples == 0) |
+ return -1; |
+ return sum * 100 / num_samples; |
+} |
} // namespace webrtc |