OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 | 70 |
71 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; | 71 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; |
72 | 72 |
73 SendStatisticsProxy::SendStatisticsProxy( | 73 SendStatisticsProxy::SendStatisticsProxy( |
74 Clock* clock, | 74 Clock* clock, |
75 const VideoSendStream::Config& config, | 75 const VideoSendStream::Config& config, |
76 VideoEncoderConfig::ContentType content_type) | 76 VideoEncoderConfig::ContentType content_type) |
77 : clock_(clock), | 77 : clock_(clock), |
78 payload_name_(config.encoder_settings.payload_name), | 78 config_(config), |
79 rtp_config_(config.rtp), | |
80 content_type_(content_type), | 79 content_type_(content_type), |
81 start_ms_(clock->TimeInMilliseconds()), | 80 start_ms_(clock->TimeInMilliseconds()), |
82 last_sent_frame_timestamp_(0), | 81 last_sent_frame_timestamp_(0), |
83 encode_time_(kEncodeTimeWeigthFactor), | 82 encode_time_(kEncodeTimeWeigthFactor), |
84 uma_container_( | 83 uma_container_( |
85 new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) { | 84 new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) { |
86 } | 85 } |
87 | 86 |
88 SendStatisticsProxy::~SendStatisticsProxy() { | 87 SendStatisticsProxy::~SendStatisticsProxy() { |
89 rtc::CritScope lock(&crit_); | 88 rtc::CritScope lock(&crit_); |
90 uma_container_->UpdateHistograms(rtp_config_, stats_); | 89 uma_container_->UpdateHistograms(config_, stats_); |
91 | 90 |
92 int64_t elapsed_sec = (clock_->TimeInMilliseconds() - start_ms_) / 1000; | 91 int64_t elapsed_sec = (clock_->TimeInMilliseconds() - start_ms_) / 1000; |
93 RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendStreamLifetimeInSeconds", | 92 RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendStreamLifetimeInSeconds", |
94 elapsed_sec); | 93 elapsed_sec); |
95 | 94 |
96 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) | 95 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) |
97 UpdateCodecTypeHistogram(payload_name_); | 96 UpdateCodecTypeHistogram(config_.encoder_settings.payload_name); |
98 } | 97 } |
99 | 98 |
100 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( | 99 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( |
101 const char* prefix, | 100 const char* prefix, |
102 const VideoSendStream::Stats& stats, | 101 const VideoSendStream::Stats& stats, |
103 Clock* const clock) | 102 Clock* const clock) |
104 : uma_prefix_(prefix), | 103 : uma_prefix_(prefix), |
105 clock_(clock), | 104 clock_(clock), |
106 max_sent_width_per_timestamp_(0), | 105 max_sent_width_per_timestamp_(0), |
107 max_sent_height_per_timestamp_(0), | 106 max_sent_height_per_timestamp_(0), |
108 input_frame_rate_tracker_(100, 10u), | 107 input_frame_rate_tracker_(100, 10u), |
109 sent_frame_rate_tracker_(100, 10u), | 108 sent_frame_rate_tracker_(100, 10u), |
110 first_rtcp_stats_time_ms_(-1), | 109 first_rtcp_stats_time_ms_(-1), |
111 first_rtp_stats_time_ms_(-1), | 110 first_rtp_stats_time_ms_(-1), |
112 start_stats_(stats) {} | 111 start_stats_(stats) {} |
113 | 112 |
114 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {} | 113 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {} |
115 | 114 |
116 void AccumulateRtxStats(const VideoSendStream::Stats& stats, | 115 void AccumulateRtpStats(const VideoSendStream::Stats& stats, |
117 const std::vector<uint32_t>& rtx_ssrcs, | 116 const VideoSendStream::Config& config, |
118 StreamDataCounters* total_rtp_stats, | 117 StreamDataCounters* total_rtp_stats, |
119 StreamDataCounters* rtx_stats) { | 118 StreamDataCounters* rtx_stats) { |
120 for (auto it : stats.substreams) { | 119 for (auto it : stats.substreams) { |
| 120 const std::vector<uint32_t> rtx_ssrcs = config.rtp.rtx.ssrcs; |
121 if (std::find(rtx_ssrcs.begin(), rtx_ssrcs.end(), it.first) != | 121 if (std::find(rtx_ssrcs.begin(), rtx_ssrcs.end(), it.first) != |
122 rtx_ssrcs.end()) { | 122 rtx_ssrcs.end()) { |
123 rtx_stats->Add(it.second.rtp_stats); | 123 rtx_stats->Add(it.second.rtp_stats); |
124 } else { | 124 } else { |
125 total_rtp_stats->Add(it.second.rtp_stats); | 125 total_rtp_stats->Add(it.second.rtp_stats); |
126 } | 126 } |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( | 130 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( |
131 const VideoSendStream::Config::Rtp& rtp_config, | 131 const VideoSendStream::Config& config, |
132 const VideoSendStream::Stats& current_stats) { | 132 const VideoSendStream::Stats& current_stats) { |
133 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); | 133 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); |
134 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; | 134 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; |
135 const int kMinRequiredSamples = 200; | 135 const int kMinRequiredSamples = 200; |
136 int in_width = input_width_counter_.Avg(kMinRequiredSamples); | 136 int in_width = input_width_counter_.Avg(kMinRequiredSamples); |
137 int in_height = input_height_counter_.Avg(kMinRequiredSamples); | 137 int in_height = input_height_counter_.Avg(kMinRequiredSamples); |
138 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); | 138 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); |
139 if (in_width != -1) { | 139 if (in_width != -1) { |
140 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 140 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
141 kIndex, uma_prefix_ + "InputWidthInPixels", in_width); | 141 kIndex, uma_prefix_ + "InputWidthInPixels", in_width); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 // The RTCP packet type counters, delivered via the | 257 // The RTCP packet type counters, delivered via the |
258 // RtcpPacketTypeCounterObserver interface, are aggregates over the entire | 258 // RtcpPacketTypeCounterObserver interface, are aggregates over the entire |
259 // life of the send stream and are not reset when switching content type. | 259 // life of the send stream and are not reset when switching content type. |
260 // For the purpose of these statistics though, we want new counts when | 260 // For the purpose of these statistics though, we want new counts when |
261 // switching since we switch histogram name. On every reset of the | 261 // switching since we switch histogram name. On every reset of the |
262 // UmaSamplesContainer, we save the initial state of the counters, so that | 262 // UmaSamplesContainer, we save the initial state of the counters, so that |
263 // we can calculate the delta here and aggregate over all ssrcs. | 263 // we can calculate the delta here and aggregate over all ssrcs. |
264 RtcpPacketTypeCounter counters; | 264 RtcpPacketTypeCounter counters; |
265 for (uint32_t ssrc : rtp_config.ssrcs) { | 265 for (uint32_t ssrc : config.rtp.ssrcs) { |
266 auto kv = current_stats.substreams.find(ssrc); | 266 auto kv = current_stats.substreams.find(ssrc); |
267 if (kv == current_stats.substreams.end()) | 267 if (kv == current_stats.substreams.end()) |
268 continue; | 268 continue; |
269 | 269 |
270 RtcpPacketTypeCounter stream_counters = | 270 RtcpPacketTypeCounter stream_counters = |
271 kv->second.rtcp_packet_type_counts; | 271 kv->second.rtcp_packet_type_counts; |
272 kv = start_stats_.substreams.find(ssrc); | 272 kv = start_stats_.substreams.find(ssrc); |
273 if (kv != start_stats_.substreams.end()) | 273 if (kv != start_stats_.substreams.end()) |
274 stream_counters.Subtract(kv->second.rtcp_packet_type_counts); | 274 stream_counters.Subtract(kv->second.rtcp_packet_type_counts); |
275 | 275 |
(...skipping 15 matching lines...) Expand all Loading... |
291 } | 291 } |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 if (first_rtp_stats_time_ms_ != -1) { | 295 if (first_rtp_stats_time_ms_ != -1) { |
296 int64_t elapsed_sec = | 296 int64_t elapsed_sec = |
297 (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000; | 297 (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000; |
298 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { | 298 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { |
299 StreamDataCounters rtp; | 299 StreamDataCounters rtp; |
300 StreamDataCounters rtx; | 300 StreamDataCounters rtx; |
301 AccumulateRtxStats(current_stats, rtp_config.rtx.ssrcs, &rtp, &rtx); | 301 AccumulateRtpStats(current_stats, config, &rtp, &rtx); |
302 StreamDataCounters start_rtp; | 302 StreamDataCounters start_rtp; |
303 StreamDataCounters start_rtx; | 303 StreamDataCounters start_rtx; |
304 AccumulateRtxStats(start_stats_, rtp_config.rtx.ssrcs, &start_rtp, | 304 AccumulateRtpStats(start_stats_, config, &start_rtp, &start_rtx); |
305 &start_rtx); | |
306 rtp.Subtract(start_rtp); | 305 rtp.Subtract(start_rtp); |
307 rtx.Subtract(start_rtx); | 306 rtx.Subtract(start_rtx); |
308 StreamDataCounters rtp_rtx = rtp; | 307 StreamDataCounters rtp_rtx = rtp; |
309 rtp_rtx.Add(rtx); | 308 rtp_rtx.Add(rtx); |
310 | 309 |
311 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 310 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
312 kIndex, uma_prefix_ + "BitrateSentInKbps", | 311 kIndex, uma_prefix_ + "BitrateSentInKbps", |
313 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 312 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
314 1000)); | 313 1000)); |
315 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 314 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
316 kIndex, uma_prefix_ + "MediaBitrateSentInKbps", | 315 kIndex, uma_prefix_ + "MediaBitrateSentInKbps", |
317 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 316 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
318 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 317 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
319 kIndex, uma_prefix_ + "PaddingBitrateSentInKbps", | 318 kIndex, uma_prefix_ + "PaddingBitrateSentInKbps", |
320 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / | 319 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / |
321 1000)); | 320 1000)); |
322 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 321 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
323 kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps", | 322 kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps", |
324 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / | 323 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / |
325 elapsed_sec / 1000)); | 324 elapsed_sec / 1000)); |
326 if (!rtp_config.rtx.ssrcs.empty()) { | 325 if (!config.rtp.rtx.ssrcs.empty()) { |
327 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 326 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
328 kIndex, uma_prefix_ + "RtxBitrateSentInKbps", | 327 kIndex, uma_prefix_ + "RtxBitrateSentInKbps", |
329 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 328 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
330 1000)); | 329 1000)); |
331 } | 330 } |
332 if (rtp_config.fec.red_payload_type != -1) { | 331 if (config.rtp.fec.red_payload_type != -1) { |
333 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( | 332 RTC_LOGGED_HISTOGRAMS_COUNTS_10000( |
334 kIndex, uma_prefix_ + "FecBitrateSentInKbps", | 333 kIndex, uma_prefix_ + "FecBitrateSentInKbps", |
335 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / | 334 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / |
336 1000)); | 335 1000)); |
337 } | 336 } |
338 } | 337 } |
339 } | 338 } |
340 } | 339 } |
341 | 340 |
342 void SendStatisticsProxy::SetContentType( | 341 void SendStatisticsProxy::SetContentType( |
343 VideoEncoderConfig::ContentType content_type) { | 342 VideoEncoderConfig::ContentType content_type) { |
344 rtc::CritScope lock(&crit_); | 343 rtc::CritScope lock(&crit_); |
345 if (content_type_ != content_type) { | 344 if (content_type_ != content_type) { |
346 uma_container_->UpdateHistograms(rtp_config_, stats_); | 345 uma_container_->UpdateHistograms(config_, stats_); |
347 uma_container_.reset( | 346 uma_container_.reset( |
348 new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_)); | 347 new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_)); |
349 content_type_ = content_type; | 348 content_type_ = content_type; |
350 } | 349 } |
351 } | 350 } |
352 | 351 |
353 void SendStatisticsProxy::OnEncoderStatsUpdate( | 352 void SendStatisticsProxy::OnEncoderStatsUpdate( |
354 uint32_t framerate, | 353 uint32_t framerate, |
355 uint32_t bitrate, | 354 uint32_t bitrate, |
356 const std::string& encoder_name) { | 355 const std::string& encoder_name) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 396 } |
398 | 397 |
399 VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry( | 398 VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry( |
400 uint32_t ssrc) { | 399 uint32_t ssrc) { |
401 std::map<uint32_t, VideoSendStream::StreamStats>::iterator it = | 400 std::map<uint32_t, VideoSendStream::StreamStats>::iterator it = |
402 stats_.substreams.find(ssrc); | 401 stats_.substreams.find(ssrc); |
403 if (it != stats_.substreams.end()) | 402 if (it != stats_.substreams.end()) |
404 return &it->second; | 403 return &it->second; |
405 | 404 |
406 bool is_rtx = false; | 405 bool is_rtx = false; |
407 if (std::find(rtp_config_.ssrcs.begin(), rtp_config_.ssrcs.end(), ssrc) == | 406 if (std::find(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end(), ssrc) == |
408 rtp_config_.ssrcs.end()) { | 407 config_.rtp.ssrcs.end()) { |
409 if (std::find(rtp_config_.rtx.ssrcs.begin(), rtp_config_.rtx.ssrcs.end(), | 408 if (std::find(config_.rtp.rtx.ssrcs.begin(), config_.rtp.rtx.ssrcs.end(), |
410 ssrc) == rtp_config_.rtx.ssrcs.end()) { | 409 ssrc) == config_.rtp.rtx.ssrcs.end()) { |
411 return nullptr; | 410 return nullptr; |
412 } | 411 } |
413 is_rtx = true; | 412 is_rtx = true; |
414 } | 413 } |
415 | 414 |
416 // Insert new entry and return ptr. | 415 // Insert new entry and return ptr. |
417 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc]; | 416 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc]; |
418 entry->is_rtx = is_rtx; | 417 entry->is_rtx = is_rtx; |
419 | 418 |
420 return entry; | 419 return entry; |
(...skipping 22 matching lines...) Expand all Loading... |
443 size_t simulcast_idx = 0; | 442 size_t simulcast_idx = 0; |
444 | 443 |
445 if (codec_info) { | 444 if (codec_info) { |
446 if (codec_info->codecType == kVideoCodecVP8) { | 445 if (codec_info->codecType == kVideoCodecVP8) { |
447 simulcast_idx = codec_info->codecSpecific.VP8.simulcastIdx; | 446 simulcast_idx = codec_info->codecSpecific.VP8.simulcastIdx; |
448 } else if (codec_info->codecType == kVideoCodecGeneric) { | 447 } else if (codec_info->codecType == kVideoCodecGeneric) { |
449 simulcast_idx = codec_info->codecSpecific.generic.simulcast_idx; | 448 simulcast_idx = codec_info->codecSpecific.generic.simulcast_idx; |
450 } | 449 } |
451 } | 450 } |
452 | 451 |
453 if (simulcast_idx >= rtp_config_.ssrcs.size()) { | 452 if (simulcast_idx >= config_.rtp.ssrcs.size()) { |
454 LOG(LS_ERROR) << "Encoded image outside simulcast range (" << simulcast_idx | 453 LOG(LS_ERROR) << "Encoded image outside simulcast range (" << simulcast_idx |
455 << " >= " << rtp_config_.ssrcs.size() << ")."; | 454 << " >= " << config_.rtp.ssrcs.size() << ")."; |
456 return; | 455 return; |
457 } | 456 } |
458 uint32_t ssrc = rtp_config_.ssrcs[simulcast_idx]; | 457 uint32_t ssrc = config_.rtp.ssrcs[simulcast_idx]; |
459 | 458 |
460 rtc::CritScope lock(&crit_); | 459 rtc::CritScope lock(&crit_); |
461 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 460 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
462 if (!stats) | 461 if (!stats) |
463 return; | 462 return; |
464 | 463 |
465 stats->width = encoded_image._encodedWidth; | 464 stats->width = encoded_image._encodedWidth; |
466 stats->height = encoded_image._encodedHeight; | 465 stats->height = encoded_image._encodedHeight; |
467 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); | 466 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
468 | 467 |
(...skipping 17 matching lines...) Expand all Loading... |
486 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; | 485 bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; |
487 uma_container_->bw_limited_frame_counter_.Add(bw_limited); | 486 uma_container_->bw_limited_frame_counter_.Add(bw_limited); |
488 if (bw_limited) { | 487 if (bw_limited) { |
489 uma_container_->bw_resolutions_disabled_counter_.Add( | 488 uma_container_->bw_resolutions_disabled_counter_.Add( |
490 encoded_image.adapt_reason_.bw_resolutions_disabled); | 489 encoded_image.adapt_reason_.bw_resolutions_disabled); |
491 } | 490 } |
492 } | 491 } |
493 | 492 |
494 if (encoded_image.qp_ != -1 && codec_info) { | 493 if (encoded_image.qp_ != -1 && codec_info) { |
495 if (codec_info->codecType == kVideoCodecVP8) { | 494 if (codec_info->codecType == kVideoCodecVP8) { |
496 int spatial_idx = (rtp_config_.ssrcs.size() == 1) | 495 int spatial_idx = (config_.rtp.ssrcs.size() == 1) |
497 ? -1 | 496 ? -1 |
498 : static_cast<int>(simulcast_idx); | 497 : static_cast<int>(simulcast_idx); |
499 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); | 498 uma_container_->qp_counters_[spatial_idx].vp8.Add(encoded_image.qp_); |
500 } else if (codec_info->codecType == kVideoCodecVP9) { | 499 } else if (codec_info->codecType == kVideoCodecVP9) { |
501 int spatial_idx = (codec_info->codecSpecific.VP9.num_spatial_layers == 1) | 500 int spatial_idx = (codec_info->codecSpecific.VP9.num_spatial_layers == 1) |
502 ? -1 | 501 ? -1 |
503 : codec_info->codecSpecific.VP9.spatial_idx; | 502 : codec_info->codecSpecific.VP9.spatial_idx; |
504 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_); | 503 uma_container_->qp_counters_[spatial_idx].vp9.Add(encoded_image.qp_); |
505 } | 504 } |
506 } | 505 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 return Fraction(min_required_samples, 1000.0f); | 640 return Fraction(min_required_samples, 1000.0f); |
642 } | 641 } |
643 | 642 |
644 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 643 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
645 int min_required_samples, float multiplier) const { | 644 int min_required_samples, float multiplier) const { |
646 if (num_samples < min_required_samples || num_samples == 0) | 645 if (num_samples < min_required_samples || num_samples == 0) |
647 return -1; | 646 return -1; |
648 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 647 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
649 } | 648 } |
650 } // namespace webrtc | 649 } // namespace webrtc |
OLD | NEW |