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

Side by Side Diff: webrtc/video/send_statistics_proxy.cc

Issue 1405023014: Add histograms for send-side delay stats for a sent video stream: (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); 114 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples);
115 if (bw_limited != -1) { 115 if (bw_limited != -1) {
116 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent", 116 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent",
117 bw_limited); 117 bw_limited);
118 } 118 }
119 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); 119 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples);
120 if (num_disabled != -1) { 120 if (num_disabled != -1) {
121 RTC_HISTOGRAM_ENUMERATION( 121 RTC_HISTOGRAM_ENUMERATION(
122 "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10); 122 "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10);
123 } 123 }
124 int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
125 if (delay_ms != -1)
126 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendSideDelayInMs", delay_ms);
127
128 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
129 if (max_delay_ms != -1) {
130 RTC_HISTOGRAM_COUNTS_100000(
131 "WebRTC.Video.SendSideDelayMaxInMs", max_delay_ms);
132 }
124 } 133 }
125 134
126 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { 135 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) {
127 rtc::CritScope lock(&crit_); 136 rtc::CritScope lock(&crit_);
128 stats_.encode_frame_rate = framerate; 137 stats_.encode_frame_rate = framerate;
129 stats_.media_bitrate_bps = bitrate; 138 stats_.media_bitrate_bps = bitrate;
130 } 139 }
131 140
132 void SendStatisticsProxy::CpuOveruseMetricsUpdated( 141 void SendStatisticsProxy::CpuOveruseMetricsUpdated(
133 const CpuOveruseMetrics& metrics) { 142 const CpuOveruseMetrics& metrics) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 339
331 void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms, 340 void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms,
332 int max_delay_ms, 341 int max_delay_ms,
333 uint32_t ssrc) { 342 uint32_t ssrc) {
334 rtc::CritScope lock(&crit_); 343 rtc::CritScope lock(&crit_);
335 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 344 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
336 if (stats == nullptr) 345 if (stats == nullptr)
337 return; 346 return;
338 stats->avg_delay_ms = avg_delay_ms; 347 stats->avg_delay_ms = avg_delay_ms;
339 stats->max_delay_ms = max_delay_ms; 348 stats->max_delay_ms = max_delay_ms;
349
350 delay_counter_.Add(avg_delay_ms);
351 max_delay_counter_.Add(max_delay_ms);
340 } 352 }
341 353
342 void SendStatisticsProxy::SampleCounter::Add(int sample) { 354 void SendStatisticsProxy::SampleCounter::Add(int sample) {
343 sum += sample; 355 sum += sample;
344 ++num_samples; 356 ++num_samples;
345 } 357 }
346 358
347 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 359 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
348 if (num_samples < min_required_samples || num_samples == 0) 360 if (num_samples < min_required_samples || num_samples == 0)
349 return -1; 361 return -1;
(...skipping 17 matching lines...) Expand all
367 } 379 }
368 380
369 int SendStatisticsProxy::BoolSampleCounter::Fraction( 381 int SendStatisticsProxy::BoolSampleCounter::Fraction(
370 int min_required_samples, float multiplier) const { 382 int min_required_samples, float multiplier) const {
371 if (num_samples < min_required_samples || num_samples == 0) 383 if (num_samples < min_required_samples || num_samples == 0)
372 return -1; 384 return -1;
373 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 385 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
374 } 386 }
375 387
376 } // namespace webrtc 388 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698