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

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

Issue 2784543002: Revert of Don't hardcode MediaType::ANY in FakeNetworkPipe. (Closed)
Patch Set: Created 3 years, 8 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') | webrtc/test/fake_network_pipe_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 10 matching lines...) Expand all
21 #include "webrtc/call/call.h" 21 #include "webrtc/call/call.h"
22 #include "webrtc/system_wrappers/include/clock.h" 22 #include "webrtc/system_wrappers/include/clock.h"
23 23
24 namespace webrtc { 24 namespace webrtc {
25 25
26 namespace { 26 namespace {
27 constexpr int64_t kDefaultProcessIntervalMs = 5; 27 constexpr int64_t kDefaultProcessIntervalMs = 5;
28 } 28 }
29 29
30 FakeNetworkPipe::FakeNetworkPipe(Clock* clock, 30 FakeNetworkPipe::FakeNetworkPipe(Clock* clock,
31 const FakeNetworkPipe::Config& config, 31 const FakeNetworkPipe::Config& config)
32 MediaType media_type) 32 : FakeNetworkPipe(clock, config, 1) {}
33 : FakeNetworkPipe(clock, config, media_type, 1) {}
34 33
35 FakeNetworkPipe::FakeNetworkPipe(Clock* clock, 34 FakeNetworkPipe::FakeNetworkPipe(Clock* clock,
36 const FakeNetworkPipe::Config& config, 35 const FakeNetworkPipe::Config& config,
37 MediaType media_type,
38 uint64_t seed) 36 uint64_t seed)
39 : clock_(clock), 37 : clock_(clock),
40 media_type_(media_type),
41 packet_receiver_(NULL), 38 packet_receiver_(NULL),
42 random_(seed), 39 random_(seed),
43 config_(), 40 config_(),
44 dropped_packets_(0), 41 dropped_packets_(0),
45 sent_packets_(0), 42 sent_packets_(0),
46 total_packet_delay_(0), 43 total_packet_delay_(0),
47 bursting_(false), 44 bursting_(false),
48 next_process_time_(clock_->TimeInMilliseconds()), 45 next_process_time_(clock_->TimeInMilliseconds()),
49 last_log_time_(clock_->TimeInMilliseconds()) { 46 last_log_time_(clock_->TimeInMilliseconds()) {
50 SetConfig(config); 47 SetConfig(config);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // |time_now| might be later than when the packet should have arrived, due 192 // |time_now| might be later than when the packet should have arrived, due
196 // to NetworkProcess being called too late. For stats, use the time it 193 // to NetworkProcess being called too late. For stats, use the time it
197 // should have been on the link. 194 // should have been on the link.
198 total_packet_delay_ += packet->arrival_time() - packet->send_time(); 195 total_packet_delay_ += packet->arrival_time() - packet->send_time();
199 } 196 }
200 sent_packets_ += packets_to_deliver.size(); 197 sent_packets_ += packets_to_deliver.size();
201 } 198 }
202 while (!packets_to_deliver.empty()) { 199 while (!packets_to_deliver.empty()) {
203 NetworkPacket* packet = packets_to_deliver.front(); 200 NetworkPacket* packet = packets_to_deliver.front();
204 packets_to_deliver.pop(); 201 packets_to_deliver.pop();
205 packet_receiver_->DeliverPacket(media_type_, packet->data(), 202 packet_receiver_->DeliverPacket(MediaType::ANY, packet->data(),
206 packet->data_length(), PacketTime()); 203 packet->data_length(), PacketTime());
207 delete packet; 204 delete packet;
208 } 205 }
209 206
210 next_process_time_ = !delay_link_.empty() 207 next_process_time_ = !delay_link_.empty()
211 ? (*delay_link_.begin())->arrival_time() 208 ? (*delay_link_.begin())->arrival_time()
212 : time_now + kDefaultProcessIntervalMs; 209 : time_now + kDefaultProcessIntervalMs;
213 } 210 }
214 211
215 int64_t FakeNetworkPipe::TimeUntilNextProcess() const { 212 int64_t FakeNetworkPipe::TimeUntilNextProcess() const {
216 rtc::CritScope crit(&lock_); 213 rtc::CritScope crit(&lock_);
217 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(), 214 return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(),
218 0); 215 0);
219 } 216 }
220 217
221 } // namespace webrtc 218 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/test/fake_network_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698