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

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: Fix win compile issue... 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
« no previous file with comments | « 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 static_cast<int>(total_packet_delay_ /
150 static_cast<int64_t>(sent_packets_));
150 } 151 }
151 152
152 void FakeNetworkPipe::Process() { 153 void FakeNetworkPipe::Process() {
153 int64_t time_now = clock_->TimeInMilliseconds(); 154 int64_t time_now = clock_->TimeInMilliseconds();
154 std::queue<NetworkPacket*> packets_to_deliver; 155 std::queue<NetworkPacket*> packets_to_deliver;
155 { 156 {
156 rtc::CritScope crit(&lock_); 157 rtc::CritScope crit(&lock_);
157 // Check the capacity link first. 158 // Check the capacity link first.
158 while (capacity_link_.size() > 0 && 159 while (capacity_link_.size() > 0 &&
159 time_now >= capacity_link_.front()->arrival_time()) { 160 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 { 210 int64_t FakeNetworkPipe::TimeUntilNextProcess() const {
210 rtc::CritScope crit(&lock_); 211 rtc::CritScope crit(&lock_);
211 const int64_t kDefaultProcessIntervalMs = 30; 212 const int64_t kDefaultProcessIntervalMs = 30;
212 if (capacity_link_.size() == 0 || delay_link_.size() == 0) 213 if (capacity_link_.size() == 0 || delay_link_.size() == 0)
213 return kDefaultProcessIntervalMs; 214 return kDefaultProcessIntervalMs;
214 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(), 215 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(),
215 0); 216 0);
216 } 217 }
217 218
218 } // namespace webrtc 219 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698