OLD | NEW |
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 |
11 #ifndef WEBRTC_WIN | 11 #ifndef WEBRTC_WIN |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 #endif | 14 #endif |
15 | 15 |
| 16 #include <algorithm> |
16 #include <sstream> | 17 #include <sstream> |
17 | 18 |
| 19 #include "webrtc/base/random.h" |
18 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" |
20 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" |
21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" |
22 #include "webrtc/test/testsupport/fileutils.h" | 24 #include "webrtc/test/testsupport/fileutils.h" |
23 | 25 |
24 using std::string; | 26 using std::string; |
25 | 27 |
26 namespace webrtc { | 28 namespace webrtc { |
27 namespace testing { | 29 namespace testing { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 jitter.SetMaxJitter(120); | 237 jitter.SetMaxJitter(120); |
236 RunFor(5 * 60 * 1000); | 238 RunFor(5 * 60 * 1000); |
237 } | 239 } |
238 | 240 |
239 // This test fixture is used to instantiate tests running with adaptive video | 241 // This test fixture is used to instantiate tests running with adaptive video |
240 // senders. | 242 // senders. |
241 class BweFeedbackTest | 243 class BweFeedbackTest |
242 : public BweTest, | 244 : public BweTest, |
243 public ::testing::TestWithParam<BandwidthEstimatorType> { | 245 public ::testing::TestWithParam<BandwidthEstimatorType> { |
244 public: | 246 public: |
245 BweFeedbackTest() : BweTest() {} | 247 #ifdef WEBRTC_WIN |
| 248 BweFeedbackTest() |
| 249 : BweTest(), random_(Clock::GetRealTimeClock()->TimeInMicroseconds()) {} |
| 250 #else |
| 251 BweFeedbackTest() |
| 252 : BweTest(), |
| 253 // Multiply the time by a random-ish odd number derived from the PID. |
| 254 random_((getpid() | 1) * |
| 255 Clock::GetRealTimeClock()->TimeInMicroseconds()) {} |
| 256 #endif |
246 virtual ~BweFeedbackTest() {} | 257 virtual ~BweFeedbackTest() {} |
247 | 258 |
248 protected: | 259 protected: |
249 void SetUp() override { | 260 Random random_; |
250 unsigned int seed = Clock::GetRealTimeClock()->TimeInMicroseconds(); | |
251 #ifndef WEBRTC_WIN | |
252 seed *= getpid(); | |
253 #endif | |
254 srand(seed); | |
255 BweTest::SetUp(); | |
256 } | |
257 | 261 |
258 private: | 262 private: |
259 RTC_DISALLOW_COPY_AND_ASSIGN(BweFeedbackTest); | 263 RTC_DISALLOW_COPY_AND_ASSIGN(BweFeedbackTest); |
260 }; | 264 }; |
261 | 265 |
262 INSTANTIATE_TEST_CASE_P(VideoSendersTest, | 266 INSTANTIATE_TEST_CASE_P(VideoSendersTest, |
263 BweFeedbackTest, | 267 BweFeedbackTest, |
264 ::testing::Values(kRembEstimator, | 268 ::testing::Values(kRembEstimator, |
265 kFullSendSideEstimator)); | 269 kFullSendSideEstimator)); |
266 | 270 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 0, receiver.GetDelayStats(), counter2.GetBitrateStats()); | 353 0, receiver.GetDelayStats(), counter2.GetBitrateStats()); |
350 } | 354 } |
351 | 355 |
352 TEST_P(BweFeedbackTest, PacedSelfFairness50msTest) { | 356 TEST_P(BweFeedbackTest, PacedSelfFairness50msTest) { |
353 int64_t kRttMs = 100; | 357 int64_t kRttMs = 100; |
354 int64_t kMaxJitterMs = 15; | 358 int64_t kMaxJitterMs = 15; |
355 | 359 |
356 const int kNumRmcatFlows = 4; | 360 const int kNumRmcatFlows = 4; |
357 int64_t offset_ms[kNumRmcatFlows]; | 361 int64_t offset_ms[kNumRmcatFlows]; |
358 for (int i = 0; i < kNumRmcatFlows; ++i) { | 362 for (int i = 0; i < kNumRmcatFlows; ++i) { |
359 offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); | 363 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
360 } | 364 } |
361 | 365 |
362 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 50, kRttMs, | 366 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 50, kRttMs, |
363 kMaxJitterMs, offset_ms); | 367 kMaxJitterMs, offset_ms); |
364 } | 368 } |
365 | 369 |
366 TEST_P(BweFeedbackTest, PacedSelfFairness500msTest) { | 370 TEST_P(BweFeedbackTest, PacedSelfFairness500msTest) { |
367 int64_t kRttMs = 100; | 371 int64_t kRttMs = 100; |
368 int64_t kMaxJitterMs = 15; | 372 int64_t kMaxJitterMs = 15; |
369 | 373 |
370 const int kNumRmcatFlows = 4; | 374 const int kNumRmcatFlows = 4; |
371 int64_t offset_ms[kNumRmcatFlows]; | 375 int64_t offset_ms[kNumRmcatFlows]; |
372 for (int i = 0; i < kNumRmcatFlows; ++i) { | 376 for (int i = 0; i < kNumRmcatFlows; ++i) { |
373 offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); | 377 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
374 } | 378 } |
375 | 379 |
376 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 500, kRttMs, | 380 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 500, kRttMs, |
377 kMaxJitterMs, offset_ms); | 381 kMaxJitterMs, offset_ms); |
378 } | 382 } |
379 | 383 |
380 TEST_P(BweFeedbackTest, PacedSelfFairness1000msTest) { | 384 TEST_P(BweFeedbackTest, PacedSelfFairness1000msTest) { |
381 int64_t kRttMs = 100; | 385 int64_t kRttMs = 100; |
382 int64_t kMaxJitterMs = 15; | 386 int64_t kMaxJitterMs = 15; |
383 | 387 |
384 const int kNumRmcatFlows = 4; | 388 const int kNumRmcatFlows = 4; |
385 int64_t offset_ms[kNumRmcatFlows]; | 389 int64_t offset_ms[kNumRmcatFlows]; |
386 for (int i = 0; i < kNumRmcatFlows; ++i) { | 390 for (int i = 0; i < kNumRmcatFlows; ++i) { |
387 offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); | 391 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
388 } | 392 } |
389 | 393 |
390 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 1000, kRttMs, | 394 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 1000, kRttMs, |
391 kMaxJitterMs, offset_ms); | 395 kMaxJitterMs, offset_ms); |
392 } | 396 } |
393 | 397 |
394 TEST_P(BweFeedbackTest, TcpFairness50msTest) { | 398 TEST_P(BweFeedbackTest, TcpFairness50msTest) { |
395 int64_t kRttMs = 100; | 399 int64_t kRttMs = 100; |
396 int64_t kMaxJitterMs = 15; | 400 int64_t kMaxJitterMs = 15; |
397 | 401 |
398 int64_t offset_ms[2]; // One TCP, one RMCAT flow. | 402 int64_t offset_ms[2]; // One TCP, one RMCAT flow. |
399 for (int i = 0; i < 2; ++i) { | 403 for (int i = 0; i < 2; ++i) { |
400 offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); | 404 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
401 } | 405 } |
402 | 406 |
403 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 50, kRttMs, kMaxJitterMs, | 407 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 50, kRttMs, kMaxJitterMs, |
404 offset_ms); | 408 offset_ms); |
405 } | 409 } |
406 | 410 |
407 TEST_P(BweFeedbackTest, TcpFairness500msTest) { | 411 TEST_P(BweFeedbackTest, TcpFairness500msTest) { |
408 int64_t kRttMs = 100; | 412 int64_t kRttMs = 100; |
409 int64_t kMaxJitterMs = 15; | 413 int64_t kMaxJitterMs = 15; |
410 | 414 |
411 int64_t offset_ms[2]; // One TCP, one RMCAT flow. | 415 int64_t offset_ms[2]; // One TCP, one RMCAT flow. |
412 for (int i = 0; i < 2; ++i) { | 416 for (int i = 0; i < 2; ++i) { |
413 offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); | 417 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
414 } | 418 } |
415 | 419 |
416 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 500, kRttMs, kMaxJitterMs, | 420 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 500, kRttMs, kMaxJitterMs, |
417 offset_ms); | 421 offset_ms); |
418 } | 422 } |
419 | 423 |
420 TEST_P(BweFeedbackTest, TcpFairness1000msTest) { | 424 TEST_P(BweFeedbackTest, TcpFairness1000msTest) { |
421 int64_t kRttMs = 100; | 425 int64_t kRttMs = 100; |
422 int64_t kMaxJitterMs = 15; | 426 int64_t kMaxJitterMs = 15; |
423 | 427 |
424 int64_t offset_ms[2]; // One TCP, one RMCAT flow. | 428 int64_t offset_ms[2]; // One TCP, one RMCAT flow. |
425 for (int i = 0; i < 2; ++i) { | 429 for (int i = 0; i < 2; ++i) { |
426 offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); | 430 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
427 } | 431 } |
428 | 432 |
429 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 1000, kRttMs, kMaxJitterMs, | 433 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 1000, kRttMs, kMaxJitterMs, |
430 offset_ms); | 434 offset_ms); |
431 } | 435 } |
432 } // namespace bwe | 436 } // namespace bwe |
433 } // namespace testing | 437 } // namespace testing |
434 } // namespace webrtc | 438 } // namespace webrtc |
OLD | NEW |