OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 choke.SetCapacity(1000); | 109 choke.SetCapacity(1000); |
110 choke.SetMaxDelay(500); | 110 choke.SetMaxDelay(500); |
111 RunFor(60 * 1000); | 111 RunFor(60 * 1000); |
112 choke.SetCapacity(500); | 112 choke.SetCapacity(500); |
113 RunFor(60 * 1000); | 113 RunFor(60 * 1000); |
114 choke.SetCapacity(1000); | 114 choke.SetCapacity(1000); |
115 RunFor(60 * 1000); | 115 RunFor(60 * 1000); |
116 } | 116 } |
117 | 117 |
118 TEST_P(BweSimulation, PacerChoke1000kbps500kbps1000kbps) { | 118 TEST_P(BweSimulation, PacerChoke1000kbps500kbps1000kbps) { |
119 PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000); | 119 AdaptiveVideoSource source(0, 30, 300, 0, 0); |
120 PacedVideoSender sender(&uplink_, &source, GetParam()); | 120 PacedVideoSender sender(&uplink_, &source, GetParam()); |
121 ChokeFilter filter(&uplink_, 0); | 121 ChokeFilter filter(&uplink_, 0); |
122 RateCounterFilter counter(&uplink_, 0, "receiver_input"); | 122 RateCounterFilter counter(&uplink_, 0, "receiver_input"); |
123 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); | 123 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); |
124 filter.SetCapacity(1000); | 124 filter.SetCapacity(1000); |
125 filter.SetMaxDelay(500); | 125 filter.SetMaxDelay(500); |
126 RunFor(60 * 1000); | 126 RunFor(60 * 1000); |
127 filter.SetCapacity(500); | 127 filter.SetCapacity(500); |
128 RunFor(60 * 1000); | 128 RunFor(60 * 1000); |
129 filter.SetCapacity(1000); | 129 filter.SetCapacity(1000); |
130 RunFor(60 * 1000); | 130 RunFor(60 * 1000); |
131 } | 131 } |
132 | 132 |
133 TEST_P(BweSimulation, PacerChoke10000kbps) { | 133 TEST_P(BweSimulation, PacerChoke10000kbps) { |
134 PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000); | 134 PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000); |
135 PacedVideoSender sender(&uplink_, &source, GetParam()); | 135 PacedVideoSender sender(&uplink_, &source, GetParam()); |
136 ChokeFilter filter(&uplink_, 0); | 136 ChokeFilter filter(&uplink_, 0); |
137 RateCounterFilter counter(&uplink_, 0, "receiver_input"); | 137 RateCounterFilter counter(&uplink_, 0, "receiver_input"); |
138 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); | 138 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); |
139 filter.SetCapacity(10000); | 139 filter.SetCapacity(10000); |
140 filter.SetMaxDelay(500); | 140 filter.SetMaxDelay(500); |
141 RunFor(60 * 1000); | 141 RunFor(60 * 1000); |
142 } | 142 } |
143 | 143 |
144 TEST_P(BweSimulation, PacerChoke200kbps30kbps200kbps) { | 144 TEST_P(BweSimulation, PacerChoke200kbps30kbps200kbps) { |
145 PeriodicKeyFrameSource source(0, 30, 300, 0, 0, 1000); | 145 AdaptiveVideoSource source(0, 30, 300, 0, 0); |
146 PacedVideoSender sender(&uplink_, &source, GetParam()); | 146 PacedVideoSender sender(&uplink_, &source, GetParam()); |
147 ChokeFilter filter(&uplink_, 0); | 147 ChokeFilter filter(&uplink_, 0); |
148 RateCounterFilter counter(&uplink_, 0, "receiver_input"); | 148 RateCounterFilter counter(&uplink_, 0, "receiver_input"); |
149 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); | 149 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); |
150 filter.SetCapacity(200); | 150 filter.SetCapacity(200); |
151 filter.SetMaxDelay(500); | 151 filter.SetMaxDelay(500); |
152 RunFor(60 * 1000); | 152 RunFor(60 * 1000); |
153 filter.SetCapacity(30); | 153 filter.SetCapacity(30); |
154 RunFor(60 * 1000); | 154 RunFor(60 * 1000); |
155 filter.SetCapacity(200); | 155 filter.SetCapacity(200); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 RateCounterFilter counter1(&uplink_, 0, "sender_output"); | 227 RateCounterFilter counter1(&uplink_, 0, "sender_output"); |
228 TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity"); | 228 TraceBasedDeliveryFilter filter(&uplink_, 0, "link_capacity"); |
229 filter.SetMaxDelay(500); | 229 filter.SetMaxDelay(500); |
230 RateCounterFilter counter2(&uplink_, 0, "receiver_input"); | 230 RateCounterFilter counter2(&uplink_, 0, "receiver_input"); |
231 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); | 231 PacketReceiver receiver(&uplink_, 0, GetParam(), true, true); |
232 ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx"))); | 232 ASSERT_TRUE(filter.Init(test::ResourcePath("google-wifi-3mbps", "rx"))); |
233 RunFor(300 * 1000); | 233 RunFor(300 * 1000); |
234 } | 234 } |
235 | 235 |
236 TEST_P(BweSimulation, SelfFairnessTest) { | 236 TEST_P(BweSimulation, SelfFairnessTest) { |
237 const int kAllFlowIds[] = {0, 1, 2}; | 237 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
| 238 const int kAllFlowIds[] = {0, 1, 2, 3}; |
238 const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]); | 239 const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]); |
239 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; | 240 rtc::scoped_ptr<VideoSource> sources[kNumFlows]; |
240 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; | 241 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; |
241 for (size_t i = 0; i < kNumFlows; ++i) { | 242 for (size_t i = 0; i < kNumFlows; ++i) { |
242 // Streams started 20 seconds apart to give them different advantage when | 243 // Streams started 20 seconds apart to give them different advantage when |
243 // competing for the bandwidth. | 244 // competing for the bandwidth. |
244 sources[i].reset( | 245 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, |
245 new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, i * 20000)); | 246 i * (rand() % 40000))); |
246 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), GetParam())); | 247 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), GetParam())); |
247 } | 248 } |
248 | 249 |
249 ChokeFilter choke(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); | 250 ChokeFilter choke(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); |
250 choke.SetCapacity(1000); | 251 choke.SetCapacity(1000); |
251 | 252 |
252 rtc::scoped_ptr<RateCounterFilter> rate_counters[kNumFlows]; | 253 rtc::scoped_ptr<RateCounterFilter> rate_counters[kNumFlows]; |
253 for (size_t i = 0; i < kNumFlows; ++i) { | 254 for (size_t i = 0; i < kNumFlows; ++i) { |
254 rate_counters[i].reset(new RateCounterFilter( | 255 rate_counters[i].reset(new RateCounterFilter( |
255 &uplink_, CreateFlowIds(&kAllFlowIds[i], 1), "receiver_input")); | 256 &uplink_, CreateFlowIds(&kAllFlowIds[i], 1), "receiver_input")); |
256 } | 257 } |
257 | 258 |
258 RateCounterFilter total_utilization( | 259 RateCounterFilter total_utilization( |
259 &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "total_utilization"); | 260 &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "total_utilization"); |
260 | 261 |
261 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; | 262 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; |
262 for (size_t i = 0; i < kNumFlows; ++i) { | 263 for (size_t i = 0; i < kNumFlows; ++i) { |
263 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(), | 264 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(), |
264 i == 0, false)); | 265 i == 0, false)); |
265 } | 266 } |
266 | 267 |
267 RunFor(30 * 60 * 1000); | 268 RunFor(30 * 60 * 1000); |
268 } | 269 } |
269 | 270 |
270 TEST_P(BweSimulation, PacedSelfFairnessTest) { | 271 TEST_P(BweSimulation, PacedSelfFairness50msTest) { |
271 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); | 272 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
272 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 50); | 273 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 50); |
273 } | 274 } |
274 | 275 |
| 276 TEST_P(BweSimulation, PacedSelfFairness500msTest) { |
| 277 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
| 278 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 500); |
| 279 } |
| 280 |
275 TEST_P(BweSimulation, PacedSelfFairness1000msTest) { | 281 TEST_P(BweSimulation, PacedSelfFairness1000msTest) { |
276 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); | 282 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
277 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000); | 283 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000); |
278 } | 284 } |
279 | 285 |
280 TEST_P(BweSimulation, TcpFairness50msTest) { | 286 TEST_P(BweSimulation, TcpFairness50msTest) { |
281 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); | 287 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
282 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50); | 288 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50); |
283 } | 289 } |
284 | 290 |
285 TEST_P(BweSimulation, TcpFairness500msTest) { | 291 TEST_P(BweSimulation, TcpFairness500msTest) { |
286 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); | 292 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
287 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500); | 293 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500); |
288 } | 294 } |
289 | 295 |
290 TEST_P(BweSimulation, TcpFairness1000msTest) { | 296 TEST_P(BweSimulation, TcpFairness1000msTest) { |
291 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); | 297 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); |
292 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000); | 298 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000); |
293 } | 299 } |
294 | 300 |
295 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE | 301 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE |
296 } // namespace bwe | 302 } // namespace bwe |
297 } // namespace testing | 303 } // namespace testing |
298 } // namespace webrtc | 304 } // namespace webrtc |
OLD | NEW |