Chromium Code Reviews

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