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

Side by Side Diff: webrtc/test/fake_network_pipe.cc

Issue 1582833002: Add ramp-up tests for transport sequence number with and w/o audio. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
« webrtc/call/rampup_tests.cc ('K') | « webrtc/test/fake_network_pipe.h ('k') | no next file » | 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 return static_cast<float>(dropped_packets_) / 140 return static_cast<float>(dropped_packets_) /
141 (sent_packets_ + dropped_packets_); 141 (sent_packets_ + dropped_packets_);
142 } 142 }
143 143
144 int FakeNetworkPipe::AverageDelay() { 144 int FakeNetworkPipe::AverageDelay() {
145 rtc::CritScope crit(&lock_); 145 rtc::CritScope crit(&lock_);
146 if (sent_packets_ == 0) 146 if (sent_packets_ == 0)
147 return 0; 147 return 0;
148 148
149 return total_packet_delay_ / static_cast<int>(sent_packets_); 149 return total_packet_delay_ / static_cast<int64_t>(sent_packets_);
150 } 150 }
151 151
152 void FakeNetworkPipe::Process() { 152 void FakeNetworkPipe::Process() {
153 int64_t time_now = clock_->TimeInMilliseconds(); 153 int64_t time_now = clock_->TimeInMilliseconds();
154 std::queue<NetworkPacket*> packets_to_deliver; 154 std::queue<NetworkPacket*> packets_to_deliver;
155 { 155 {
156 rtc::CritScope crit(&lock_); 156 rtc::CritScope crit(&lock_);
157 // Check the capacity link first. 157 // Check the capacity link first.
158 while (capacity_link_.size() > 0 && 158 while (capacity_link_.size() > 0 &&
159 time_now >= capacity_link_.front()->arrival_time()) { 159 time_now >= capacity_link_.front()->arrival_time()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 int64_t FakeNetworkPipe::TimeUntilNextProcess() const { 209 int64_t FakeNetworkPipe::TimeUntilNextProcess() const {
210 rtc::CritScope crit(&lock_); 210 rtc::CritScope crit(&lock_);
211 const int64_t kDefaultProcessIntervalMs = 30; 211 const int64_t kDefaultProcessIntervalMs = 30;
212 if (capacity_link_.size() == 0 || delay_link_.size() == 0) 212 if (capacity_link_.size() == 0 || delay_link_.size() == 0)
213 return kDefaultProcessIntervalMs; 213 return kDefaultProcessIntervalMs;
214 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(), 214 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(),
215 0); 215 0);
216 } 216 }
217 217
218 } // namespace webrtc 218 } // namespace webrtc
OLDNEW
« webrtc/call/rampup_tests.cc ('K') | « webrtc/test/fake_network_pipe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698