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

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

Issue 1512853002: Nuke TickTime::UseFakeClock. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 5 years 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_engine/call_stats.h ('k') | webrtc/video_engine/call_stats_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) 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 virtual int64_t LastProcessedRtt() const { 82 virtual int64_t LastProcessedRtt() const {
83 return owner_->avg_rtt_ms(); 83 return owner_->avg_rtt_ms();
84 } 84 }
85 85
86 private: 86 private:
87 CallStats* owner_; 87 CallStats* owner_;
88 88
89 RTC_DISALLOW_COPY_AND_ASSIGN(RtcpObserver); 89 RTC_DISALLOW_COPY_AND_ASSIGN(RtcpObserver);
90 }; 90 };
91 91
92 CallStats::CallStats() 92 CallStats::CallStats(Clock* clock)
93 : crit_(CriticalSectionWrapper::CreateCriticalSection()), 93 : clock_(clock),
94 crit_(CriticalSectionWrapper::CreateCriticalSection()),
94 rtcp_rtt_stats_(new RtcpObserver(this)), 95 rtcp_rtt_stats_(new RtcpObserver(this)),
95 last_process_time_(TickTime::MillisecondTimestamp()), 96 last_process_time_(clock_->TimeInMilliseconds()),
96 max_rtt_ms_(0), 97 max_rtt_ms_(0),
97 avg_rtt_ms_(0) { 98 avg_rtt_ms_(0) {}
98 }
99 99
100 CallStats::~CallStats() { 100 CallStats::~CallStats() {
101 assert(observers_.empty()); 101 assert(observers_.empty());
102 } 102 }
103 103
104 int64_t CallStats::TimeUntilNextProcess() { 104 int64_t CallStats::TimeUntilNextProcess() {
105 return last_process_time_ + kUpdateIntervalMs - 105 return last_process_time_ + kUpdateIntervalMs - clock_->TimeInMilliseconds();
106 TickTime::MillisecondTimestamp();
107 } 106 }
108 107
109 int32_t CallStats::Process() { 108 int32_t CallStats::Process() {
110 CriticalSectionScoped cs(crit_.get()); 109 CriticalSectionScoped cs(crit_.get());
111 int64_t now = TickTime::MillisecondTimestamp(); 110 int64_t now = clock_->TimeInMilliseconds();
112 if (now < last_process_time_ + kUpdateIntervalMs) 111 if (now < last_process_time_ + kUpdateIntervalMs)
113 return 0; 112 return 0;
114 113
115 last_process_time_ = now; 114 last_process_time_ = now;
116 115
117 RemoveOldReports(now, &reports_); 116 RemoveOldReports(now, &reports_);
118 max_rtt_ms_ = GetMaxRttMs(&reports_); 117 max_rtt_ms_ = GetMaxRttMs(&reports_);
119 UpdateAvgRttMs(&reports_, &avg_rtt_ms_); 118 UpdateAvgRttMs(&reports_, &avg_rtt_ms_);
120 119
121 // If there is a valid rtt, update all observers with the max rtt. 120 // If there is a valid rtt, update all observers with the max rtt.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 it != observers_.end(); ++it) { 153 it != observers_.end(); ++it) {
155 if (*it == observer) { 154 if (*it == observer) {
156 observers_.erase(it); 155 observers_.erase(it);
157 return; 156 return;
158 } 157 }
159 } 158 }
160 } 159 }
161 160
162 void CallStats::OnRttUpdate(int64_t rtt) { 161 void CallStats::OnRttUpdate(int64_t rtt) {
163 CriticalSectionScoped cs(crit_.get()); 162 CriticalSectionScoped cs(crit_.get());
164 reports_.push_back(RttTime(rtt, TickTime::MillisecondTimestamp())); 163 reports_.push_back(RttTime(rtt, clock_->TimeInMilliseconds()));
165 } 164 }
166 165
167 } // namespace webrtc 166 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video_engine/call_stats.h ('k') | webrtc/video_engine/call_stats_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698