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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 1311533012: Add histogram for percentage of sent frames that are limited in resolution due to bandwidth. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months 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 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

Powered by Google App Engine
This is Rietveld 408576698