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

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

Issue 1737013002: Reland of move ignored return code from modules. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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/call_stats.h ('k') | webrtc/video/overuse_frame_detector.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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 CallStats::~CallStats() { 103 CallStats::~CallStats() {
104 RTC_DCHECK(observers_.empty()); 104 RTC_DCHECK(observers_.empty());
105 UpdateHistograms(); 105 UpdateHistograms();
106 } 106 }
107 107
108 int64_t CallStats::TimeUntilNextProcess() { 108 int64_t CallStats::TimeUntilNextProcess() {
109 return last_process_time_ + kUpdateIntervalMs - clock_->TimeInMilliseconds(); 109 return last_process_time_ + kUpdateIntervalMs - clock_->TimeInMilliseconds();
110 } 110 }
111 111
112 int32_t CallStats::Process() { 112 void CallStats::Process() {
113 rtc::CritScope cs(&crit_); 113 rtc::CritScope cs(&crit_);
114 int64_t now = clock_->TimeInMilliseconds(); 114 int64_t now = clock_->TimeInMilliseconds();
115 if (now < last_process_time_ + kUpdateIntervalMs) 115 if (now < last_process_time_ + kUpdateIntervalMs)
116 return 0; 116 return;
117 117
118 last_process_time_ = now; 118 last_process_time_ = now;
119 119
120 RemoveOldReports(now, &reports_); 120 RemoveOldReports(now, &reports_);
121 max_rtt_ms_ = GetMaxRttMs(&reports_); 121 max_rtt_ms_ = GetMaxRttMs(&reports_);
122 UpdateAvgRttMs(&reports_, &avg_rtt_ms_); 122 UpdateAvgRttMs(&reports_, &avg_rtt_ms_);
123 123
124 // If there is a valid rtt, update all observers with the max rtt. 124 // If there is a valid rtt, update all observers with the max rtt.
125 if (max_rtt_ms_ >= 0) { 125 if (max_rtt_ms_ >= 0) {
126 RTC_DCHECK_GE(avg_rtt_ms_, 0); 126 RTC_DCHECK_GE(avg_rtt_ms_, 0);
127 for (std::list<CallStatsObserver*>::iterator it = observers_.begin(); 127 for (std::list<CallStatsObserver*>::iterator it = observers_.begin();
128 it != observers_.end(); ++it) { 128 it != observers_.end(); ++it) {
129 (*it)->OnRttUpdate(avg_rtt_ms_, max_rtt_ms_); 129 (*it)->OnRttUpdate(avg_rtt_ms_, max_rtt_ms_);
130 } 130 }
131 // Sum for Histogram of average RTT reported over the entire call. 131 // Sum for Histogram of average RTT reported over the entire call.
132 sum_avg_rtt_ms_ += avg_rtt_ms_; 132 sum_avg_rtt_ms_ += avg_rtt_ms_;
133 ++num_avg_rtt_; 133 ++num_avg_rtt_;
134 } 134 }
135 return 0;
136 } 135 }
137 136
138 int64_t CallStats::avg_rtt_ms() const { 137 int64_t CallStats::avg_rtt_ms() const {
139 rtc::CritScope cs(&crit_); 138 rtc::CritScope cs(&crit_);
140 return avg_rtt_ms_; 139 return avg_rtt_ms_;
141 } 140 }
142 141
143 RtcpRttStats* CallStats::rtcp_rtt_stats() const { 142 RtcpRttStats* CallStats::rtcp_rtt_stats() const {
144 return rtcp_rtt_stats_.get(); 143 return rtcp_rtt_stats_.get();
145 } 144 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 int64_t elapsed_sec = 180 int64_t elapsed_sec =
182 (clock_->TimeInMilliseconds() - time_of_first_rtt_ms_) / 1000; 181 (clock_->TimeInMilliseconds() - time_of_first_rtt_ms_) / 1000;
183 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) { 182 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) {
184 int64_t avg_rtt_ms = (sum_avg_rtt_ms_ + num_avg_rtt_ / 2) / num_avg_rtt_; 183 int64_t avg_rtt_ms = (sum_avg_rtt_ms_ + num_avg_rtt_ / 2) / num_avg_rtt_;
185 RTC_HISTOGRAM_COUNTS_10000( 184 RTC_HISTOGRAM_COUNTS_10000(
186 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms); 185 "WebRTC.Video.AverageRoundTripTimeInMilliseconds", avg_rtt_ms);
187 } 186 }
188 } 187 }
189 188
190 } // namespace webrtc 189 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/call_stats.h ('k') | webrtc/video/overuse_frame_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698