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

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

Issue 1669623004: Use CallStats for RTT in Call, rather than VideoSendStream::GetRtt() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment, rebase Created 4 years, 10 months 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/video_send_stream.h » ('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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 SendStatisticsProxy::~SendStatisticsProxy() {} 84 SendStatisticsProxy::~SendStatisticsProxy() {}
85 85
86 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( 86 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer(
87 const char* prefix) 87 const char* prefix)
88 : uma_prefix_(prefix), 88 : uma_prefix_(prefix),
89 max_sent_width_per_timestamp_(0), 89 max_sent_width_per_timestamp_(0),
90 max_sent_height_per_timestamp_(0), 90 max_sent_height_per_timestamp_(0),
91 input_frame_rate_tracker_(100u, 10u), 91 input_frame_rate_tracker_(100u, 10u),
92 sent_frame_rate_tracker_(100u, 10u) {} 92 sent_frame_rate_tracker_(100u, 10u),
93 first_rtcp_stats_time_ms_(-1) {}
93 94
94 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() { 95 SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {
95 UpdateHistograms(); 96 UpdateHistograms();
96 } 97 }
97 98
98 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { 99 void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() {
99 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix); 100 RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix);
100 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0; 101 const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0;
101 const int kMinRequiredSamples = 200; 102 const int kMinRequiredSamples = 200;
102 int in_width = input_width_counter_.Avg(kMinRequiredSamples); 103 int in_width = input_width_counter_.Avg(kMinRequiredSamples);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 int delay_ms = delay_counter_.Avg(kMinRequiredSamples); 160 int delay_ms = delay_counter_.Avg(kMinRequiredSamples);
160 if (delay_ms != -1) 161 if (delay_ms != -1)
161 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs", 162 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayInMs",
162 delay_ms); 163 delay_ms);
163 164
164 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); 165 int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples);
165 if (max_delay_ms != -1) { 166 if (max_delay_ms != -1) {
166 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs", 167 RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs",
167 max_delay_ms); 168 max_delay_ms);
168 } 169 }
170 int fraction_lost = report_block_stats_.FractionLostInPercent();
171 if (first_rtcp_stats_time_ms_ != -1) {
172 int64_t elapsed_time_ms = Clock::GetRealTimeClock()->TimeInMilliseconds() -
173 first_rtcp_stats_time_ms_;
174 if (elapsed_time_ms / 1000 >= metrics::kMinRunTimeInSeconds &&
175 fraction_lost != -1) {
176 RTC_HISTOGRAMS_PERCENTAGE(
177 kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
178 }
179 }
169 } 180 }
170 181
171 void SendStatisticsProxy::SetContentType( 182 void SendStatisticsProxy::SetContentType(
172 VideoEncoderConfig::ContentType content_type) { 183 VideoEncoderConfig::ContentType content_type) {
173 rtc::CritScope lock(&crit_); 184 rtc::CritScope lock(&crit_);
174 if (content_type_ != content_type) { 185 if (content_type_ != content_type) {
175 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type))); 186 uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type)));
176 content_type_ = content_type; 187 content_type_ = content_type;
177 } 188 }
178 } 189 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 358 }
348 359
349 void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics, 360 void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics,
350 uint32_t ssrc) { 361 uint32_t ssrc) {
351 rtc::CritScope lock(&crit_); 362 rtc::CritScope lock(&crit_);
352 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 363 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
353 if (stats == nullptr) 364 if (stats == nullptr)
354 return; 365 return;
355 366
356 stats->rtcp_stats = statistics; 367 stats->rtcp_stats = statistics;
368 uma_container_->report_block_stats_.Store(statistics, 0, ssrc);
369 if (uma_container_->first_rtcp_stats_time_ms_ == -1)
370 uma_container_->first_rtcp_stats_time_ms_ = clock_->TimeInMilliseconds();
357 } 371 }
358 372
359 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {} 373 void SendStatisticsProxy::CNameChanged(const char* cname, uint32_t ssrc) {}
360 374
361 void SendStatisticsProxy::DataCountersUpdated( 375 void SendStatisticsProxy::DataCountersUpdated(
362 const StreamDataCounters& counters, 376 const StreamDataCounters& counters,
363 uint32_t ssrc) { 377 uint32_t ssrc) {
364 rtc::CritScope lock(&crit_); 378 rtc::CritScope lock(&crit_);
365 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 379 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
366 RTC_DCHECK(stats != nullptr) 380 RTC_DCHECK(stats != nullptr)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return Fraction(min_required_samples, 1000.0f); 446 return Fraction(min_required_samples, 1000.0f);
433 } 447 }
434 448
435 int SendStatisticsProxy::BoolSampleCounter::Fraction( 449 int SendStatisticsProxy::BoolSampleCounter::Fraction(
436 int min_required_samples, float multiplier) const { 450 int min_required_samples, float multiplier) const {
437 if (num_samples < min_required_samples || num_samples == 0) 451 if (num_samples < min_required_samples || num_samples == 0)
438 return -1; 452 return -1;
439 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 453 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
440 } 454 }
441 } // namespace webrtc 455 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video/video_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698