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

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

Issue 1433393002: Add separate send-side UMA stats for screenshare and video. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Actually run UpdateHistograms... Created 5 years 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') | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | 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 13 matching lines...) Expand all
24 namespace { 24 namespace {
25 // Used by histograms. Values of entries should not be changed. 25 // Used by histograms. Values of entries should not be changed.
26 enum HistogramCodecType { 26 enum HistogramCodecType {
27 kVideoUnknown = 0, 27 kVideoUnknown = 0,
28 kVideoVp8 = 1, 28 kVideoVp8 = 1,
29 kVideoVp9 = 2, 29 kVideoVp9 = 2,
30 kVideoH264 = 3, 30 kVideoH264 = 3,
31 kVideoMax = 64, 31 kVideoMax = 64,
32 }; 32 };
33 33
34 const char* GetUmaPrefix(VideoEncoderConfig::ContentType content_type) {
35 switch (content_type) {
36 case VideoEncoderConfig::ContentType::kRealtimeVideo:
37 return "WebRTC.Video.";
38 case VideoEncoderConfig::ContentType::kScreen:
39 return "WebRTC.Video.Screenshare.";
40 default:
41 RTC_NOTREACHED() << "Unknown content type.";
pbos-webrtc 2015/12/03 13:22:33 Remove the default case here so we get compile err
sprang_webrtc 2015/12/03 13:32:55 Done.
42 return "";
43 }
44 }
45
34 HistogramCodecType PayloadNameToHistogramCodecType( 46 HistogramCodecType PayloadNameToHistogramCodecType(
35 const std::string& payload_name) { 47 const std::string& payload_name) {
36 if (payload_name == "VP8") { 48 if (payload_name == "VP8") {
37 return kVideoVp8; 49 return kVideoVp8;
38 } else if (payload_name == "VP9") { 50 } else if (payload_name == "VP9") {
39 return kVideoVp9; 51 return kVideoVp9;
40 } else if (payload_name == "H264") { 52 } else if (payload_name == "H264") {
41 return kVideoH264; 53 return kVideoH264;
42 } else { 54 } else {
43 return kVideoUnknown; 55 return kVideoUnknown;
44 } 56 }
45 } 57 }
46 58
47 void UpdateCodecTypeHistogram(const std::string& payload_name) { 59 void UpdateCodecTypeHistogram(const std::string& payload_name) {
48 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType", 60 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType",
49 PayloadNameToHistogramCodecType(payload_name), kVideoMax); 61 PayloadNameToHistogramCodecType(payload_name), kVideoMax);
50 } 62 }
51 } // namespace 63 } // namespace
52 64
53 65
54 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; 66 const int SendStatisticsProxy::kStatsTimeoutMs = 5000;
55 67
56 SendStatisticsProxy::SendStatisticsProxy(Clock* clock, 68 SendStatisticsProxy::SendStatisticsProxy(
57 const VideoSendStream::Config& config) 69 Clock* clock,
70 const VideoSendStream::Config& config,
71 VideoEncoderConfig::ContentType content_type)
58 : clock_(clock), 72 : clock_(clock),
59 config_(config), 73 config_(config),
60 input_frame_rate_tracker_(100u, 10u), 74 content_type_(content_type),
61 sent_frame_rate_tracker_(100u, 10u),
62 last_sent_frame_timestamp_(0), 75 last_sent_frame_timestamp_(0),
63 max_sent_width_per_timestamp_(0), 76 uma_container_(new UmaSamplesContainer(GetUmaPrefix(content_type_))) {
64 max_sent_height_per_timestamp_(0) {
65 UpdateCodecTypeHistogram(config_.encoder_settings.payload_name); 77 UpdateCodecTypeHistogram(config_.encoder_settings.payload_name);
66 } 78 }
67 79
68 SendStatisticsProxy::~SendStatisticsProxy() { 80 SendStatisticsProxy::~SendStatisticsProxy() {
69 UpdateHistograms(); 81 uma_container_->UpdateHistograms();
pbos-webrtc 2015/12/03 13:22:33 Maybe move this to the uma container dtor instead?
sprang_webrtc 2015/12/03 13:32:55 Done.
mflodman 2015/12/04 08:30:52 I don't agree about this. We'll soon start callin
70 } 82 }
71 83
72 void SendStatisticsProxy::UpdateHistograms() { 84 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer(
85 const char* prefix)
86 : uma_prefix_(prefix),
87 max_sent_width_per_timestamp_(0),
88 max_sent_height_per_timestamp_(0),
89 input_frame_rate_tracker_(100u, 10u),
90 sent_frame_rate_tracker_(100u, 10u) {}
91
92 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() {
73 const int kMinRequiredSamples = 200; 93 const int kMinRequiredSamples = 200;
74 int in_width = input_width_counter_.Avg(kMinRequiredSamples); 94 int in_width = input_width_counter_.Avg(kMinRequiredSamples);
75 int in_height = input_height_counter_.Avg(kMinRequiredSamples); 95 int in_height = input_height_counter_.Avg(kMinRequiredSamples);
76 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); 96 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate());
77 if (in_width != -1) { 97 if (in_width != -1) {
78 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputWidthInPixels", in_width); 98 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputWidthInPixels", in_width);
79 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputHeightInPixels", in_height); 99 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputHeightInPixels", in_height);
80 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", in_fps); 100 RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "InputFramesPerSecond", in_fps);
81 } 101 }
82 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); 102 int sent_width = sent_width_counter_.Avg(kMinRequiredSamples);
83 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); 103 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples);
84 int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); 104 int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate());
85 if (sent_width != -1) { 105 if (sent_width != -1) {
86 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); 106 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentWidthInPixels", sent_width);
87 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); 107 RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentHeightInPixels", sent_height);
88 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); 108 RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "SentFramesPerSecond", sent_fps);
89 } 109 }
90 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); 110 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples);
91 if (encode_ms != -1) 111 if (encode_ms != -1)
92 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); 112 RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms);
93 113
94 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); 114 int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples);
95 if (key_frames_permille != -1) { 115 if (key_frames_permille != -1) {
96 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesSentInPermille", 116 RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "KeyFramesSentInPermille",
97 key_frames_permille); 117 key_frames_permille);
98 } 118 }
99 int quality_limited = 119 int quality_limited =
100 quality_limited_frame_counter_.Percent(kMinRequiredSamples); 120 quality_limited_frame_counter_.Percent(kMinRequiredSamples);
101 if (quality_limited != -1) { 121 if (quality_limited != -1) {
102 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.QualityLimitedResolutionInPercent", 122 RTC_HISTOGRAM_PERCENTAGE(uma_prefix_ + "QualityLimitedResolutionInPercent",
103 quality_limited); 123 quality_limited);
104 } 124 }
105 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); 125 int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples);
106 if (downscales != -1) { 126 if (downscales != -1) {
107 RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.QualityLimitedResolutionDownscales", 127 RTC_HISTOGRAM_ENUMERATION(
108 downscales, 20); 128 uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20);
109 } 129 }
110 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); 130 int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples);
111 if (bw_limited != -1) { 131 if (bw_limited != -1) {
112 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent", 132 RTC_HISTOGRAM_PERCENTAGE(
113 bw_limited); 133 uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited);
114 } 134 }
115 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); 135 int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples);
116 if (num_disabled != -1) { 136 if (num_disabled != -1) {
117 RTC_HISTOGRAM_ENUMERATION( 137 RTC_HISTOGRAM_ENUMERATION(
118 "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10); 138 uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10);
119 } 139 }
120 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); 140 int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
121 if (delay_ms != -1) 141 if (delay_ms != -1)
122 RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendSideDelayInMs", delay_ms); 142 RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayInMs", delay_ms);
123 143
124 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); 144 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
125 if (max_delay_ms != -1) { 145 if (max_delay_ms != -1) {
126 RTC_HISTOGRAM_COUNTS_100000( 146 RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayMaxInMs",
127 "WebRTC.Video.SendSideDelayMaxInMs", max_delay_ms); 147 max_delay_ms);
128 } 148 }
129 } 149 }
130 150
151 void SendStatisticsProxy::SetContentType(
152 VideoEncoderConfig::ContentType content_type) {
153 rtc::CritScope lock(&crit_);
154 if (content_type_ != content_type) {
155 uma_container_->UpdateHistograms();
156 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type)));
157 content_type_ = content_type;
158 }
159 }
160
131 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { 161 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) {
132 rtc::CritScope lock(&crit_); 162 rtc::CritScope lock(&crit_);
133 stats_.encode_frame_rate = framerate; 163 stats_.encode_frame_rate = framerate;
134 stats_.media_bitrate_bps = bitrate; 164 stats_.media_bitrate_bps = bitrate;
135 } 165 }
136 166
137 void SendStatisticsProxy::CpuOveruseMetricsUpdated( 167 void SendStatisticsProxy::CpuOveruseMetricsUpdated(
138 const CpuOveruseMetrics& metrics) { 168 const CpuOveruseMetrics& metrics) {
139 rtc::CritScope lock(&crit_); 169 rtc::CritScope lock(&crit_);
140 // TODO(asapersson): Change to use OnEncodedFrame() for avg_encode_time_ms. 170 // TODO(asapersson): Change to use OnEncodedFrame() for avg_encode_time_ms.
141 stats_.avg_encode_time_ms = metrics.avg_encode_time_ms; 171 stats_.avg_encode_time_ms = metrics.avg_encode_time_ms;
142 stats_.encode_usage_percent = metrics.encode_usage_percent; 172 stats_.encode_usage_percent = metrics.encode_usage_percent;
143 } 173 }
144 174
145 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) { 175 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) {
146 rtc::CritScope lock(&crit_); 176 rtc::CritScope lock(&crit_);
147 stats_.suspended = is_suspended; 177 stats_.suspended = is_suspended;
148 } 178 }
149 179
150 VideoSendStream::Stats SendStatisticsProxy::GetStats() { 180 VideoSendStream::Stats SendStatisticsProxy::GetStats() {
151 rtc::CritScope lock(&crit_); 181 rtc::CritScope lock(&crit_);
152 PurgeOldStats(); 182 PurgeOldStats();
153 stats_.input_frame_rate = 183 stats_.input_frame_rate =
154 round(input_frame_rate_tracker_.ComputeRate()); 184 round(uma_container_->input_frame_rate_tracker_.ComputeRate());
155 return stats_; 185 return stats_;
156 } 186 }
157 187
158 void SendStatisticsProxy::PurgeOldStats() { 188 void SendStatisticsProxy::PurgeOldStats() {
159 int64_t old_stats_ms = clock_->TimeInMilliseconds() - kStatsTimeoutMs; 189 int64_t old_stats_ms = clock_->TimeInMilliseconds() - kStatsTimeoutMs;
160 for (std::map<uint32_t, VideoSendStream::StreamStats>::iterator it = 190 for (std::map<uint32_t, VideoSendStream::StreamStats>::iterator it =
161 stats_.substreams.begin(); 191 stats_.substreams.begin();
162 it != stats_.substreams.end(); ++it) { 192 it != stats_.substreams.end(); ++it) {
163 uint32_t ssrc = it->first; 193 uint32_t ssrc = it->first;
164 if (update_times_[ssrc].resolution_update_ms <= old_stats_ms) { 194 if (update_times_[ssrc].resolution_update_ms <= old_stats_ms) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 247
218 rtc::CritScope lock(&crit_); 248 rtc::CritScope lock(&crit_);
219 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 249 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
220 if (stats == nullptr) 250 if (stats == nullptr)
221 return; 251 return;
222 252
223 stats->width = encoded_image._encodedWidth; 253 stats->width = encoded_image._encodedWidth;
224 stats->height = encoded_image._encodedHeight; 254 stats->height = encoded_image._encodedHeight;
225 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); 255 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds();
226 256
227 key_frame_counter_.Add(encoded_image._frameType == kVideoFrameKey); 257 uma_container_->key_frame_counter_.Add(encoded_image._frameType ==
258 kVideoFrameKey);
228 259
229 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { 260 if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) {
230 bool downscaled = 261 bool downscaled =
231 encoded_image.adapt_reason_.quality_resolution_downscales > 0; 262 encoded_image.adapt_reason_.quality_resolution_downscales > 0;
232 quality_limited_frame_counter_.Add(downscaled); 263 uma_container_->quality_limited_frame_counter_.Add(downscaled);
233 if (downscaled) { 264 if (downscaled) {
234 quality_downscales_counter_.Add( 265 uma_container_->quality_downscales_counter_.Add(
235 encoded_image.adapt_reason_.quality_resolution_downscales); 266 encoded_image.adapt_reason_.quality_resolution_downscales);
236 } 267 }
237 } 268 }
238 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { 269 if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) {
239 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; 270 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0;
240 bw_limited_frame_counter_.Add(bw_limited); 271 uma_container_->bw_limited_frame_counter_.Add(bw_limited);
241 if (bw_limited) { 272 if (bw_limited) {
242 bw_resolutions_disabled_counter_.Add( 273 uma_container_->bw_resolutions_disabled_counter_.Add(
243 encoded_image.adapt_reason_.bw_resolutions_disabled); 274 encoded_image.adapt_reason_.bw_resolutions_disabled);
244 } 275 }
245 } 276 }
246 277
247 // TODO(asapersson): This is incorrect if simulcast layers are encoded on 278 // TODO(asapersson): This is incorrect if simulcast layers are encoded on
248 // different threads and there is no guarantee that one frame of all layers 279 // different threads and there is no guarantee that one frame of all layers
249 // are encoded before the next start. 280 // are encoded before the next start.
250 if (last_sent_frame_timestamp_ > 0 && 281 if (last_sent_frame_timestamp_ > 0 &&
251 encoded_image._timeStamp != last_sent_frame_timestamp_) { 282 encoded_image._timeStamp != last_sent_frame_timestamp_) {
252 sent_frame_rate_tracker_.AddSamples(1); 283 uma_container_->sent_frame_rate_tracker_.AddSamples(1);
253 sent_width_counter_.Add(max_sent_width_per_timestamp_); 284 uma_container_->sent_width_counter_.Add(
254 sent_height_counter_.Add(max_sent_height_per_timestamp_); 285 uma_container_->max_sent_width_per_timestamp_);
255 max_sent_width_per_timestamp_ = 0; 286 uma_container_->sent_height_counter_.Add(
256 max_sent_height_per_timestamp_ = 0; 287 uma_container_->max_sent_height_per_timestamp_);
288 uma_container_->max_sent_width_per_timestamp_ = 0;
289 uma_container_->max_sent_height_per_timestamp_ = 0;
257 } 290 }
258 last_sent_frame_timestamp_ = encoded_image._timeStamp; 291 last_sent_frame_timestamp_ = encoded_image._timeStamp;
259 max_sent_width_per_timestamp_ = 292 uma_container_->max_sent_width_per_timestamp_ =
260 std::max(max_sent_width_per_timestamp_, 293 std::max(uma_container_->max_sent_width_per_timestamp_,
261 static_cast<int>(encoded_image._encodedWidth)); 294 static_cast<int>(encoded_image._encodedWidth));
262 max_sent_height_per_timestamp_ = 295 uma_container_->max_sent_height_per_timestamp_ =
263 std::max(max_sent_height_per_timestamp_, 296 std::max(uma_container_->max_sent_height_per_timestamp_,
264 static_cast<int>(encoded_image._encodedHeight)); 297 static_cast<int>(encoded_image._encodedHeight));
265 } 298 }
266 299
267 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { 300 void SendStatisticsProxy::OnIncomingFrame(int width, int height) {
268 rtc::CritScope lock(&crit_); 301 rtc::CritScope lock(&crit_);
269 input_frame_rate_tracker_.AddSamples(1); 302 uma_container_->input_frame_rate_tracker_.AddSamples(1);
270 input_width_counter_.Add(width); 303 uma_container_->input_width_counter_.Add(width);
271 input_height_counter_.Add(height); 304 uma_container_->input_height_counter_.Add(height);
272 } 305 }
273 306
274 void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) { 307 void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) {
275 rtc::CritScope lock(&crit_); 308 rtc::CritScope lock(&crit_);
276 encode_time_counter_.Add(encode_time_ms); 309 uma_container_->encode_time_counter_.Add(encode_time_ms);
277 } 310 }
278 311
279 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( 312 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(
280 uint32_t ssrc, 313 uint32_t ssrc,
281 const RtcpPacketTypeCounter& packet_counter) { 314 const RtcpPacketTypeCounter& packet_counter) {
282 rtc::CritScope lock(&crit_); 315 rtc::CritScope lock(&crit_);
283 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 316 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
284 if (stats == nullptr) 317 if (stats == nullptr)
285 return; 318 return;
286 319
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms, 369 void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms,
337 int max_delay_ms, 370 int max_delay_ms,
338 uint32_t ssrc) { 371 uint32_t ssrc) {
339 rtc::CritScope lock(&crit_); 372 rtc::CritScope lock(&crit_);
340 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 373 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
341 if (stats == nullptr) 374 if (stats == nullptr)
342 return; 375 return;
343 stats->avg_delay_ms = avg_delay_ms; 376 stats->avg_delay_ms = avg_delay_ms;
344 stats->max_delay_ms = max_delay_ms; 377 stats->max_delay_ms = max_delay_ms;
345 378
346 delay_counter_.Add(avg_delay_ms); 379 uma_container_->delay_counter_.Add(avg_delay_ms);
347 max_delay_counter_.Add(max_delay_ms); 380 uma_container_->max_delay_counter_.Add(max_delay_ms);
348 } 381 }
349 382
350 void SendStatisticsProxy::SampleCounter::Add(int sample) { 383 void SendStatisticsProxy::SampleCounter::Add(int sample) {
351 sum += sample; 384 sum += sample;
352 ++num_samples; 385 ++num_samples;
353 } 386 }
354 387
355 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { 388 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
356 if (num_samples < min_required_samples || num_samples == 0) 389 if (num_samples < min_required_samples || num_samples == 0)
357 return -1; 390 return -1;
(...skipping 15 matching lines...) Expand all
373 int min_required_samples) const { 406 int min_required_samples) const {
374 return Fraction(min_required_samples, 1000.0f); 407 return Fraction(min_required_samples, 1000.0f);
375 } 408 }
376 409
377 int SendStatisticsProxy::BoolSampleCounter::Fraction( 410 int SendStatisticsProxy::BoolSampleCounter::Fraction(
378 int min_required_samples, float multiplier) const { 411 int min_required_samples, float multiplier) const {
379 if (num_samples < min_required_samples || num_samples == 0) 412 if (num_samples < min_required_samples || num_samples == 0)
380 return -1; 413 return -1;
381 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 414 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
382 } 415 }
383
384 } // namespace webrtc 416 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698