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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc

Issue 1202253003: More Simulation Framework features (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Using rtc::scoped_ptr on nada_unittest.cc Created 5 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 30 matching lines...) Expand all
41 } 41 }
42 42
43 void PacketProcessorRunner::RunFor(int64_t time_ms, 43 void PacketProcessorRunner::RunFor(int64_t time_ms,
44 int64_t time_now_ms, 44 int64_t time_now_ms,
45 Packets* in_out) { 45 Packets* in_out) {
46 Packets to_process; 46 Packets to_process;
47 FindPacketsToProcess(processor_->flow_ids(), in_out, &to_process); 47 FindPacketsToProcess(processor_->flow_ids(), in_out, &to_process);
48 processor_->RunFor(time_ms, &to_process); 48 processor_->RunFor(time_ms, &to_process);
49 QueuePackets(&to_process, time_now_ms * 1000); 49 QueuePackets(&to_process, time_now_ms * 1000);
50 if (!to_process.empty()) { 50 if (!to_process.empty()) {
51 processor_->Plot((to_process.back()->send_time_us() + 500) / 1000); 51 processor_->Plot(to_process.back()->send_time_ms());
52 } 52 }
53 in_out->merge(to_process, DereferencingComparator<Packet>); 53 in_out->merge(to_process, DereferencingComparator<Packet>);
54 } 54 }
55 55
56 void PacketProcessorRunner::FindPacketsToProcess(const FlowIds& flow_ids, 56 void PacketProcessorRunner::FindPacketsToProcess(const FlowIds& flow_ids,
57 Packets* in, 57 Packets* in,
58 Packets* out) { 58 Packets* out) {
59 assert(out->empty()); 59 assert(out->empty());
60 for (Packets::iterator it = in->begin(); it != in->end();) { 60 for (Packets::iterator it = in->begin(); it != in->end();) {
61 // TODO(holmer): Further optimize this by looking for consecutive flow ids 61 // TODO(holmer): Further optimize this by looking for consecutive flow ids
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 sources.push_back(new AdaptiveVideoSource(media_flow, 30, 300, 0, 262 sources.push_back(new AdaptiveVideoSource(media_flow, 30, 300, 0,
263 kFlowStartOffsetMs)); 263 kFlowStartOffsetMs));
264 senders.push_back(new PacedVideoSender(&uplink_, sources.back(), bwe_type)); 264 senders.push_back(new PacedVideoSender(&uplink_, sources.back(), bwe_type));
265 } 265 }
266 266
267 const int64_t kTcpStartOffsetMs = 5000; 267 const int64_t kTcpStartOffsetMs = 5000;
268 for (int tcp_flow : tcp_flow_ids) 268 for (int tcp_flow : tcp_flow_ids)
269 senders.push_back(new TcpSender(&uplink_, tcp_flow, kTcpStartOffsetMs)); 269 senders.push_back(new TcpSender(&uplink_, tcp_flow, kTcpStartOffsetMs));
270 270
271 ChokeFilter choke(&uplink_, all_flow_ids); 271 ChokeFilter choke(&uplink_, all_flow_ids);
272 choke.SetCapacity(capacity_kbps); 272 choke.set_capacity_kbps(capacity_kbps);
273 choke.SetMaxDelay(max_delay_ms); 273 choke.set_max_delay_ms(max_delay_ms);
274 274
275 DelayFilter delay_uplink(&uplink_, all_flow_ids); 275 DelayFilter delay_uplink(&uplink_, all_flow_ids);
276 delay_uplink.SetDelayMs(25); 276 delay_uplink.SetOneWayDelayMs(25);
277 277
278 std::vector<RateCounterFilter*> rate_counters; 278 std::vector<RateCounterFilter*> rate_counters;
279 for (int flow : all_flow_ids) { 279 for (int flow : all_flow_ids) {
280 rate_counters.push_back( 280 rate_counters.push_back(
281 new RateCounterFilter(&uplink_, flow, "receiver_input")); 281 new RateCounterFilter(&uplink_, flow, "receiver_input"));
282 } 282 }
283 283
284 RateCounterFilter total_utilization(&uplink_, all_flow_ids, 284 RateCounterFilter total_utilization(&uplink_, all_flow_ids,
285 "total_utilization"); 285 "total_utilization");
286 286
287 std::vector<PacketReceiver*> receivers; 287 std::vector<PacketReceiver*> receivers;
288 i = 0; 288 i = 0;
289 for (int media_flow : media_flow_ids) { 289 for (int media_flow : media_flow_ids) {
290 receivers.push_back( 290 receivers.push_back(
291 new PacketReceiver(&uplink_, media_flow, bwe_type, i++ == 0, false)); 291 new PacketReceiver(&uplink_, media_flow, bwe_type, i++ == 0, false));
292 } 292 }
293 for (int tcp_flow : tcp_flow_ids) { 293 for (int tcp_flow : tcp_flow_ids) {
294 receivers.push_back( 294 receivers.push_back(
295 new PacketReceiver(&uplink_, tcp_flow, kTcpEstimator, false, false)); 295 new PacketReceiver(&uplink_, tcp_flow, kTcpEstimator, false, false));
296 } 296 }
297 297
298 DelayFilter delay_downlink(&downlink_, all_flow_ids); 298 DelayFilter delay_downlink(&downlink_, all_flow_ids);
299 delay_downlink.SetDelayMs(25); 299 delay_downlink.SetOneWayDelayMs(25);
300 300
301 RunFor(run_time_seconds * 1000); 301 RunFor(run_time_seconds * 1000);
302 302
303 std::map<int, Stats<double>> flow_throughput_kbps; 303 std::map<int, Stats<double>> flow_throughput_kbps;
304 for (RateCounterFilter* rate_counter : rate_counters) { 304 for (RateCounterFilter* rate_counter : rate_counters) {
305 int flow_id = *rate_counter->flow_ids().begin(); 305 int flow_id = *rate_counter->flow_ids().begin();
306 flow_throughput_kbps[flow_id] = rate_counter->GetBitrateStats(); 306 flow_throughput_kbps[flow_id] = rate_counter->GetBitrateStats();
307 } 307 }
308 308
309 std::map<int, Stats<double>> flow_delay_ms; 309 std::map<int, Stats<double>> flow_delay_ms;
(...skipping 10 matching lines...) Expand all
320 for (PacketSender* sender : senders) 320 for (PacketSender* sender : senders)
321 delete sender; 321 delete sender;
322 for (RateCounterFilter* rate_counter : rate_counters) 322 for (RateCounterFilter* rate_counter : rate_counters)
323 delete rate_counter; 323 delete rate_counter;
324 for (PacketReceiver* receiver : receivers) 324 for (PacketReceiver* receiver : receivers)
325 delete receiver; 325 delete receiver;
326 } 326 }
327 } // namespace bwe 327 } // namespace bwe
328 } // namespace testing 328 } // namespace testing
329 } // namespace webrtc 329 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/bwe.cc ('k') | webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698