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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc

Issue 1237393002: Evaluation tests (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed 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
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.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) 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
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "webrtc/base/scoped_ptr.h" 12 #include "webrtc/base/scoped_ptr.h"
13 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 13 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
14 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" 14 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h"
15 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" 15 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h"
16 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" 16 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
17 #include "webrtc/test/testsupport/fileutils.h" 17 #include "webrtc/test/testsupport/fileutils.h"
18 18
19 using std::string;
20 19
21 namespace webrtc { 20 namespace webrtc {
22 namespace testing { 21 namespace testing {
23 namespace bwe { 22 namespace bwe {
24 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 23 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
25 // This test fixture is used to instantiate tests running with adaptive video 24 // This test fixture is used to instantiate tests running with adaptive video
26 // senders. 25 // senders.
27 class BweSimulation : public BweTest, 26 class BweSimulation : public BweTest,
28 public ::testing::TestWithParam<BandwidthEstimatorType> { 27 public ::testing::TestWithParam<BandwidthEstimatorType> {
29 public: 28 public:
30 BweSimulation() : BweTest() {} 29 BweSimulation() : BweTest(), random_(0x12345678) {}
31 virtual ~BweSimulation() {} 30 virtual ~BweSimulation() {}
32 31
33 protected: 32 protected:
34 void SetUp() override { 33 void SetUp() override {
35 BweTest::SetUp(); 34 BweTest::SetUp();
36 VerboseLogging(true); 35 VerboseLogging(true);
37 } 36 }
38 37
38 Random random_;
39
39 private: 40 private:
40 DISALLOW_COPY_AND_ASSIGN(BweSimulation); 41 DISALLOW_COPY_AND_ASSIGN(BweSimulation);
41 }; 42 };
42 43
43 INSTANTIATE_TEST_CASE_P(VideoSendersTest, 44 INSTANTIATE_TEST_CASE_P(VideoSendersTest,
44 BweSimulation, 45 BweSimulation,
45 ::testing::Values(kRembEstimator, 46 ::testing::Values(kRembEstimator,
46 kFullSendSideEstimator, 47 kFullSendSideEstimator,
47 kNadaEstimator)); 48 kNadaEstimator));
48 49
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 for (size_t i = 0; i < kNumFlows; ++i) { 264 for (size_t i = 0; i < kNumFlows; ++i) {
264 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(), 265 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(),
265 i == 0, false)); 266 i == 0, false));
266 } 267 }
267 268
268 RunFor(30 * 60 * 1000); 269 RunFor(30 * 60 * 1000);
269 } 270 }
270 271
271 TEST_P(BweSimulation, PacedSelfFairness50msTest) { 272 TEST_P(BweSimulation, PacedSelfFairness50msTest) {
272 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 273 srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
273 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 50); 274 const int64_t kAverageOffsetMs = 20 * 1000;
275 const int kNumRmcatFlows = 4;
276 int64_t offsets_ms[kNumRmcatFlows];
277 offsets_ms[0] = static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs));
278 for (int i = 1; i < kNumRmcatFlows; ++i) {
279 offsets_ms[i] = offsets_ms[i - 1] +
280 static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs));
281 }
282 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 50, 50, 0,
283 offsets_ms);
274 } 284 }
275 285
276 TEST_P(BweSimulation, PacedSelfFairness500msTest) { 286 TEST_P(BweSimulation, PacedSelfFairness500msTest) {
277 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 287 srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
278 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 500); 288 const int64_t kAverageOffsetMs = 20 * 1000;
289 const int kNumRmcatFlows = 4;
290 int64_t offsets_ms[kNumRmcatFlows];
291 offsets_ms[0] = static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs));
292 for (int i = 1; i < kNumRmcatFlows; ++i) {
293 offsets_ms[i] = offsets_ms[i - 1] +
294 static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs));
295 }
296 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 500, 50, 0,
297 offsets_ms);
279 } 298 }
280 299
281 TEST_P(BweSimulation, PacedSelfFairness1000msTest) { 300 TEST_P(BweSimulation, PacedSelfFairness1000msTest) {
282 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 301 srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
283 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000); 302 const int64_t kAverageOffsetMs = 20 * 1000;
303 const int kNumRmcatFlows = 4;
304 int64_t offsets_ms[kNumRmcatFlows];
305 offsets_ms[0] = static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs));
306 for (int i = 1; i < kNumRmcatFlows; ++i) {
307 offsets_ms[i] = offsets_ms[i - 1] +
308 static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs));
309 }
310 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000, 50, 0, offsets_ms);
284 } 311 }
285 312
286 TEST_P(BweSimulation, TcpFairness50msTest) { 313 TEST_P(BweSimulation, TcpFairness50msTest) {
287 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 314 srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
288 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50); 315 const int64_t kAverageOffsetMs = 20 * 1000;
316 int64_t offset_ms[] = {
317 static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs), 0)};
stefan-webrtc 2015/07/22 09:30:29 This line looks strange. static_cast<>() doesn't t
magalhaesc 2015/07/22 11:24:52 Actually since we are upcasting here it is ok remo
318 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50, 50, 0, offset_ms);
289 } 319 }
290 320
291 TEST_P(BweSimulation, TcpFairness500msTest) { 321 TEST_P(BweSimulation, TcpFairness500msTest) {
292 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 322 srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
293 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500); 323 const int64_t kAverageOffsetMs = 20 * 1000;
324 int64_t offset_ms[] = {
325 static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs), 0)};
326 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500, 50, 0, offset_ms);
294 } 327 }
295 328
296 TEST_P(BweSimulation, TcpFairness1000msTest) { 329 TEST_P(BweSimulation, TcpFairness1000msTest) {
297 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 330 srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
298 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000); 331 const int kAverageOffsetMs = 20 * 1000;
332 int64_t offset_ms[] = {
333 static_cast<int64_t>(random_.Rand(0, 2 * kAverageOffsetMs), 0)};
334 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000, 50, 0, offset_ms);
335 }
336
337 // The following test cases begin with "Evaluation" as a referrence to the
338 // Internet draft https://tools.ietf.org/html/draft-ietf-rmcat-eval-test-01.
339
340 TEST_P(BweSimulation, Evaluation1) {
341 RunVariableCapacity1SingleFlow(GetParam());
342 }
343
344 TEST_P(BweSimulation, Evaluation2) {
345 RunVariableCapacity2MultipleFlows(GetParam());
346 }
347
348 TEST_P(BweSimulation, Evaluation3) {
349 RunBidirectionalFlow(GetParam());
350 }
351
352 TEST_P(BweSimulation, Evaluation4) {
353 RunSelfFairness(GetParam());
354 }
355
356 TEST_P(BweSimulation, Evaluation5) {
357 RunRoundTripTimeFairness(GetParam());
358 }
359
360 TEST_P(BweSimulation, Evaluation6) {
361 RunLongTcpFairness(GetParam());
362 }
363
364 // Different calls to the Evaluation7 will create the same FileSizes
365 // and StartingTimes as long as the seeds remain unchanged. This is essential
366 // when calling it with multiple estimators for comparison purposes.
367 TEST_P(BweSimulation, Evaluation7) {
368 const int kNumTcpFiles = 10;
369 RunMultipleShortTcpFairness(GetParam(),
370 BweTest::GetFileSizesBytes(kNumTcpFiles),
371 BweTest::GetStartingTimesMs(kNumTcpFiles));
372 }
373
374 TEST_P(BweSimulation, Evaluation8) {
375 RunPauseResumeFlows(GetParam());
376 }
377
378 // Following test cases begin with "GccComparison" run the
379 // evaluation test cases for both GCC and other calling RMCAT.
380
381 TEST_P(BweSimulation, GccComparison1) {
382 RunVariableCapacity1SingleFlow(GetParam());
383 BweTest gcc_test(false);
384 gcc_test.RunVariableCapacity1SingleFlow(kFullSendSideEstimator);
385 }
386
387 TEST_P(BweSimulation, GccComparison2) {
388 RunVariableCapacity2MultipleFlows(GetParam());
389 BweTest gcc_test(false);
390 gcc_test.RunVariableCapacity2MultipleFlows(kFullSendSideEstimator);
391 }
392
393 TEST_P(BweSimulation, GccComparison3) {
394 RunBidirectionalFlow(GetParam());
395 BweTest gcc_test(false);
396 gcc_test.RunBidirectionalFlow(kFullSendSideEstimator);
397 }
398
399 TEST_P(BweSimulation, GccComparison4) {
400 RunSelfFairness(GetParam());
401 BweTest gcc_test(false);
402 gcc_test.RunSelfFairness(GetParam());
403 }
404
405 TEST_P(BweSimulation, GccComparison5) {
406 RunRoundTripTimeFairness(GetParam());
407 BweTest gcc_test(false);
408 gcc_test.RunRoundTripTimeFairness(kFullSendSideEstimator);
409 }
410
411 TEST_P(BweSimulation, GccComparison6) {
412 RunLongTcpFairness(GetParam());
413 BweTest gcc_test(false);
414 gcc_test.RunLongTcpFairness(kFullSendSideEstimator);
415 }
416
417 TEST_P(BweSimulation, GccComparison7) {
418 const int kNumTcpFiles = 10;
419
420 std::vector<int> tcp_file_sizes_bytes =
421 BweTest::GetFileSizesBytes(kNumTcpFiles);
422 std::vector<int64_t> tcp_starting_times_ms =
423 BweTest::GetStartingTimesMs(kNumTcpFiles);
424
425 RunMultipleShortTcpFairness(GetParam(), tcp_file_sizes_bytes,
426 tcp_starting_times_ms);
427
428 BweTest gcc_test(false);
429 gcc_test.RunMultipleShortTcpFairness(
430 kFullSendSideEstimator, tcp_file_sizes_bytes, tcp_starting_times_ms);
431 }
432
433 TEST_P(BweSimulation, GccComparison8) {
434 RunPauseResumeFlows(GetParam());
435 BweTest gcc_test(false);
436 gcc_test.RunPauseResumeFlows(kFullSendSideEstimator);
437 }
438
439 TEST_P(BweSimulation, GccComparisonChoke) {
440 int array[] = {1000, 500, 1000};
441 std::vector<int> capacities_kbps(array, array + 3);
442 RunChoke(GetParam(), capacities_kbps);
443
444 BweTest gcc_test(false);
445 gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps);
299 } 446 }
300 447
301 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 448 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
302 } // namespace bwe 449 } // namespace bwe
303 } // namespace testing 450 } // namespace testing
304 } // namespace webrtc 451 } // namespace webrtc
452
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698