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

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 [3] 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()
30 : BweTest(), random_(Clock::GetRealTimeClock()->TimeInMicroseconds()) {}
31 virtual ~BweSimulation() {} 31 virtual ~BweSimulation() {}
32 32
33 protected: 33 protected:
34 void SetUp() override { 34 void SetUp() override {
35 BweTest::SetUp(); 35 BweTest::SetUp();
36 VerboseLogging(true); 36 VerboseLogging(true);
37 } 37 }
38 38
39 Random random_;
40
39 private: 41 private:
40 DISALLOW_COPY_AND_ASSIGN(BweSimulation); 42 DISALLOW_COPY_AND_ASSIGN(BweSimulation);
41 }; 43 };
42 44
43 INSTANTIATE_TEST_CASE_P(VideoSendersTest, 45 INSTANTIATE_TEST_CASE_P(VideoSendersTest,
44 BweSimulation, 46 BweSimulation,
45 ::testing::Values(kRembEstimator, 47 ::testing::Values(kRembEstimator,
46 kFullSendSideEstimator, 48 kFullSendSideEstimator,
47 kNadaEstimator)); 49 kNadaEstimator));
48 50
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; 264 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows];
263 for (size_t i = 0; i < kNumFlows; ++i) { 265 for (size_t i = 0; i < kNumFlows; ++i) {
264 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(), 266 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], GetParam(),
265 i == 0, false)); 267 i == 0, false));
266 } 268 }
267 269
268 RunFor(30 * 60 * 1000); 270 RunFor(30 * 60 * 1000);
269 } 271 }
270 272
271 TEST_P(BweSimulation, PacedSelfFairness50msTest) { 273 TEST_P(BweSimulation, PacedSelfFairness50msTest) {
272 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 274 const int64_t kAverageOffsetMs = 20 * 1000;
273 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 50); 275 const int kNumRmcatFlows = 4;
276 int64_t offsets_ms[kNumRmcatFlows];
277 offsets_ms[0] = random_.Rand(0, 2 * kAverageOffsetMs);
278 for (int i = 1; i < kNumRmcatFlows; ++i) {
279 offsets_ms[i] = offsets_ms[i - 1] + random_.Rand(0, 2 * kAverageOffsetMs);
280 }
281 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 50, 50, 0,
282 offsets_ms);
274 } 283 }
275 284
276 TEST_P(BweSimulation, PacedSelfFairness500msTest) { 285 TEST_P(BweSimulation, PacedSelfFairness500msTest) {
277 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 286 const int64_t kAverageOffsetMs = 20 * 1000;
278 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 500); 287 const int kNumRmcatFlows = 4;
288 int64_t offsets_ms[kNumRmcatFlows];
289 offsets_ms[0] = random_.Rand(0, 2 * kAverageOffsetMs);
290 for (int i = 1; i < kNumRmcatFlows; ++i) {
291 offsets_ms[i] = offsets_ms[i - 1] + random_.Rand(0, 2 * kAverageOffsetMs);
292 }
293 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 500, 50, 0,
294 offsets_ms);
279 } 295 }
280 296
281 TEST_P(BweSimulation, PacedSelfFairness1000msTest) { 297 TEST_P(BweSimulation, PacedSelfFairness1000msTest) {
282 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 298 const int64_t kAverageOffsetMs = 20 * 1000;
283 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000); 299 const int kNumRmcatFlows = 4;
300 int64_t offsets_ms[kNumRmcatFlows];
301 offsets_ms[0] = random_.Rand(0, 2 * kAverageOffsetMs);
302 for (int i = 1; i < kNumRmcatFlows; ++i) {
303 offsets_ms[i] = offsets_ms[i - 1] + random_.Rand(0, 2 * kAverageOffsetMs);
304 }
305 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000, 50, 0, offsets_ms);
284 } 306 }
285 307
286 TEST_P(BweSimulation, TcpFairness50msTest) { 308 TEST_P(BweSimulation, TcpFairness50msTest) {
287 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 309 const int64_t kAverageOffsetMs = 20 * 1000;
288 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50); 310 int64_t offset_ms[] = {random_.Rand(0, 2 * kAverageOffsetMs), 0};
311 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50, 50, 0, offset_ms);
289 } 312 }
290 313
291 TEST_P(BweSimulation, TcpFairness500msTest) { 314 TEST_P(BweSimulation, TcpFairness500msTest) {
292 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 315 const int64_t kAverageOffsetMs = 20 * 1000;
293 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500); 316 int64_t offset_ms[] = {random_.Rand(0, 2 * kAverageOffsetMs), 0};
317 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500, 50, 0, offset_ms);
294 } 318 }
295 319
296 TEST_P(BweSimulation, TcpFairness1000msTest) { 320 TEST_P(BweSimulation, TcpFairness1000msTest) {
297 srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); 321 const int kAverageOffsetMs = 20 * 1000;
298 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000); 322 int64_t offset_ms[] = {random_.Rand(0, 2 * kAverageOffsetMs), 0};
323 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000, 50, 0, offset_ms);
324 }
325
326 // The following test cases begin with "Evaluation" as a referrence to the
327 // Internet draft https://tools.ietf.org/html/draft-ietf-rmcat-eval-test-01.
328
329 TEST_P(BweSimulation, Evaluation1) {
330 RunVariableCapacity1SingleFlow(GetParam());
331 }
332
333 TEST_P(BweSimulation, Evaluation2) {
334 const size_t kNumFlows = 2;
335 RunVariableCapacity2MultipleFlows(GetParam(), kNumFlows);
336 }
337
338 TEST_P(BweSimulation, Evaluation3) {
339 RunBidirectionalFlow(GetParam());
340 }
341
342 TEST_P(BweSimulation, Evaluation4) {
343 RunSelfFairness(GetParam());
344 }
345
346 TEST_P(BweSimulation, Evaluation5) {
347 RunRoundTripTimeFairness(GetParam());
348 }
349
350 TEST_P(BweSimulation, Evaluation6) {
351 RunLongTcpFairness(GetParam());
352 }
353
354 // Different calls to the Evaluation7 will create the same FileSizes
355 // and StartingTimes as long as the seeds remain unchanged. This is essential
356 // when calling it with multiple estimators for comparison purposes.
357 TEST_P(BweSimulation, Evaluation7) {
358 const int kNumTcpFiles = 10;
359 RunMultipleShortTcpFairness(GetParam(),
360 BweTest::GetFileSizesBytes(kNumTcpFiles),
361 BweTest::GetStartingTimesMs(kNumTcpFiles));
362 }
363
364 TEST_P(BweSimulation, Evaluation8) {
365 RunPauseResumeFlows(GetParam());
366 }
367
368 // Following test cases begin with "GccComparison" run the
369 // evaluation test cases for both GCC and other calling RMCAT.
370
371 TEST_P(BweSimulation, GccComparison1) {
372 RunVariableCapacity1SingleFlow(GetParam());
373 BweTest gcc_test(false);
374 gcc_test.RunVariableCapacity1SingleFlow(kFullSendSideEstimator);
375 }
376
377 TEST_P(BweSimulation, GccComparison2) {
378 const size_t kNumFlows = 2;
379 RunVariableCapacity2MultipleFlows(GetParam(), kNumFlows);
380 BweTest gcc_test(false);
381 gcc_test.RunVariableCapacity2MultipleFlows(kFullSendSideEstimator, kNumFlows);
382 }
383
384 TEST_P(BweSimulation, GccComparison3) {
385 RunBidirectionalFlow(GetParam());
386 BweTest gcc_test(false);
387 gcc_test.RunBidirectionalFlow(kFullSendSideEstimator);
388 }
389
390 TEST_P(BweSimulation, GccComparison4) {
391 RunSelfFairness(GetParam());
392 BweTest gcc_test(false);
393 gcc_test.RunSelfFairness(GetParam());
394 }
395
396 TEST_P(BweSimulation, GccComparison5) {
397 RunRoundTripTimeFairness(GetParam());
398 BweTest gcc_test(false);
399 gcc_test.RunRoundTripTimeFairness(kFullSendSideEstimator);
400 }
401
402 TEST_P(BweSimulation, GccComparison6) {
403 RunLongTcpFairness(GetParam());
404 BweTest gcc_test(false);
405 gcc_test.RunLongTcpFairness(kFullSendSideEstimator);
406 }
407
408 TEST_P(BweSimulation, GccComparison7) {
409 const int kNumTcpFiles = 10;
410
411 std::vector<int> tcp_file_sizes_bytes =
412 BweTest::GetFileSizesBytes(kNumTcpFiles);
413 std::vector<int64_t> tcp_starting_times_ms =
414 BweTest::GetStartingTimesMs(kNumTcpFiles);
415
416 RunMultipleShortTcpFairness(GetParam(), tcp_file_sizes_bytes,
417 tcp_starting_times_ms);
418
419 BweTest gcc_test(false);
420 gcc_test.RunMultipleShortTcpFairness(
421 kFullSendSideEstimator, tcp_file_sizes_bytes, tcp_starting_times_ms);
422 }
423
424 TEST_P(BweSimulation, GccComparison8) {
425 RunPauseResumeFlows(GetParam());
426 BweTest gcc_test(false);
427 gcc_test.RunPauseResumeFlows(kFullSendSideEstimator);
428 }
429
430 TEST_P(BweSimulation, GccComparisonChoke) {
431 int array[] = {1000, 500, 1000};
432 std::vector<int> capacities_kbps(array, array + 3);
433 RunChoke(GetParam(), capacities_kbps);
434
435 BweTest gcc_test(false);
436 gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps);
299 } 437 }
300 438
301 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 439 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
302 } // namespace bwe 440 } // namespace bwe
303 } // namespace testing 441 } // namespace testing
304 } // namespace webrtc 442 } // namespace webrtc
443
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