Chromium Code Reviews| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 } | 79 } |
| 80 | 80 |
| 81 SendStatisticsProxy::~SendStatisticsProxy() {} | 81 SendStatisticsProxy::~SendStatisticsProxy() {} |
| 82 | 82 |
| 83 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( | 83 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( |
| 84 const char* prefix) | 84 const char* prefix) |
| 85 : uma_prefix_(prefix), | 85 : uma_prefix_(prefix), |
| 86 max_sent_width_per_timestamp_(0), | 86 max_sent_width_per_timestamp_(0), |
| 87 max_sent_height_per_timestamp_(0), | 87 max_sent_height_per_timestamp_(0), |
| 88 input_frame_rate_tracker_(100u, 10u), | 88 input_frame_rate_tracker_(100u, 10u), |
| 89 sent_frame_rate_tracker_(100u, 10u) {} | 89 sent_frame_rate_tracker_(100u, 10u), |
| 90 first_rtcp_stats_time_ms_(-1) {} | |
| 90 | 91 |
| 91 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() { | 92 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() { |
| 92 UpdateHistograms(); | 93 UpdateHistograms(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { | 96 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { |
| 96 const int kMinRequiredSamples = 200; | 97 const int kMinRequiredSamples = 200; |
| 97 int in_width = input_width_counter_.Avg(kMinRequiredSamples); | 98 int in_width = input_width_counter_.Avg(kMinRequiredSamples); |
| 98 int in_height = input_height_counter_.Avg(kMinRequiredSamples); | 99 int in_height = input_height_counter_.Avg(kMinRequiredSamples); |
| 99 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); | 100 int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); | 150 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); |
| 150 if (delay_ms != -1) | 151 if (delay_ms != -1) |
| 151 RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs", | 152 RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs", |
| 152 delay_ms); | 153 delay_ms); |
| 153 | 154 |
| 154 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); | 155 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); |
| 155 if (max_delay_ms != -1) { | 156 if (max_delay_ms != -1) { |
| 156 RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs", | 157 RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs", |
| 157 max_delay_ms); | 158 max_delay_ms); |
| 158 } | 159 } |
| 160 int fraction_lost = report_block_stats_.FractionLostInPercent(); | |
| 161 if (first_rtcp_stats_time_ms_ != -1) { | |
| 162 int64_t elapsed_time_ms = Clock::GetRealTimeClock()->TimeInMilliseconds() - | |
| 163 first_rtcp_stats_time_ms_; | |
| 164 if (elapsed_time_ms / 1000 >= metrics::kMinRunTimeInSeconds && | |
| 165 fraction_lost != -1) { | |
| 166 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent", | |
| 167 fraction_lost); | |
| 168 } | |
| 169 } | |
| 159 } | 170 } |
| 160 | 171 |
| 161 void SendStatisticsProxy::SetContentType( | 172 void SendStatisticsProxy::SetContentType( |
| 162 VideoEncoderConfig::ContentType content_type) { | 173 VideoEncoderConfig::ContentType content_type) { |
| 163 rtc::CritScope lock(&crit_); | 174 rtc::CritScope lock(&crit_); |
| 164 if (content_type_ != content_type) { | 175 if (content_type_ != content_type) { |
| 165 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type))); | 176 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type))); |
| 166 content_type_ = content_type; | 177 content_type_ = content_type; |
| 167 } | 178 } |
| 168 } | 179 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 } | 351 } |
| 341 | 352 |
| 342 void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics, | 353 void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics, |
| 343 uint32_t ssrc) { | 354 uint32_t ssrc) { |
| 344 rtc::CritScope lock(&crit_); | 355 rtc::CritScope lock(&crit_); |
| 345 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 356 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 346 if (stats == nullptr) | 357 if (stats == nullptr) |
| 347 return; | 358 return; |
| 348 | 359 |
| 349 stats->rtcp_stats = statistics; | 360 stats->rtcp_stats = statistics; |
| 361 uma_container_->report_block_stats_.Store(statistics, ssrc, 0); | |
|
åsapersson
2016/02/05 13:50:12
Should this be Store(statistics, 0, ssrc)?
sprang
2016/02/05 14:10:22
Done.
| |
| 362 if (uma_container_->first_rtcp_stats_time_ms_ == -1) | |
| 363 uma_container_->first_rtcp_stats_time_ms_ = clock_->TimeInMilliseconds(); | |
| 350 } | 364 } |
| 351 | 365 |
| 352 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) { | 366 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) { |
| 353 } | 367 } |
| 354 | 368 |
| 355 void SendStatisticsProxy::DataCountersUpdated( | 369 void SendStatisticsProxy::DataCountersUpdated( |
| 356 const StreamDataCounters& counters, | 370 const StreamDataCounters& counters, |
| 357 uint32_t ssrc) { | 371 uint32_t ssrc) { |
| 358 rtc::CritScope lock(&crit_); | 372 rtc::CritScope lock(&crit_); |
| 359 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 373 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 return Fraction(min_required_samples, 1000.0f); | 440 return Fraction(min_required_samples, 1000.0f); |
| 427 } | 441 } |
| 428 | 442 |
| 429 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 443 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 430 int min_required_samples, float multiplier) const { | 444 int min_required_samples, float multiplier) const { |
| 431 if (num_samples < min_required_samples || num_samples == 0) | 445 if (num_samples < min_required_samples || num_samples == 0) |
| 432 return -1; | 446 return -1; |
| 433 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 447 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 434 } | 448 } |
| 435 } // namespace webrtc | 449 } // namespace webrtc |
| OLD | NEW |