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

Side by Side Diff: webrtc/call/rampup_tests.cc

Issue 2599013002: Clean up ramp-up tests and make sure they all pass. (Closed)
Patch Set: Created 4 years 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
« webrtc/call/rampup_tests.h ('K') | « webrtc/call/rampup_tests.h ('k') | no next file » | 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) 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 : RampUpTester(num_video_streams, 360 : RampUpTester(num_video_streams,
361 num_audio_streams, 361 num_audio_streams,
362 start_bitrate_bps, 362 start_bitrate_bps,
363 extension_type, 363 extension_type,
364 rtx, 364 rtx,
365 red), 365 red),
366 test_state_(kFirstRampup), 366 test_state_(kFirstRampup),
367 state_start_ms_(clock_->TimeInMilliseconds()), 367 state_start_ms_(clock_->TimeInMilliseconds()),
368 interval_start_ms_(clock_->TimeInMilliseconds()), 368 interval_start_ms_(clock_->TimeInMilliseconds()),
369 sent_bytes_(0) { 369 sent_bytes_(0) {
370 forward_transport_config_.link_capacity_kbps = kHighBandwidthLimitBps / 1000; 370 forward_transport_config_.link_capacity_kbps = GetHighCapacity();
371 } 371 }
372 372
373 RampUpDownUpTester::~RampUpDownUpTester() {} 373 RampUpDownUpTester::~RampUpDownUpTester() {}
374 374
375 bool RampUpDownUpTester::PollStats() { 375 bool RampUpDownUpTester::PollStats() {
376 if (send_stream_) { 376 if (send_stream_) {
377 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats(); 377 webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
378 int transmit_bitrate_bps = 0; 378 int transmit_bitrate_bps = 0;
379 for (auto it : stats.substreams) { 379 for (auto it : stats.substreams) {
380 transmit_bitrate_bps += it.second.total_bitrate_bps; 380 transmit_bitrate_bps += it.second.total_bitrate_bps;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 str += "stream"; 413 str += "stream";
414 str += (num_audio_streams_ > 1 ? "s" : ""); 414 str += (num_audio_streams_ > 1 ? "s" : "");
415 str += "_"; 415 str += "_";
416 } 416 }
417 str += (rtx_ ? "" : "no"); 417 str += (rtx_ ? "" : "no");
418 str += "rtx"; 418 str += "rtx";
419 return str; 419 return str;
420 } 420 }
421 421
422 int RampUpDownUpTester::GetExpectedHighBitrate() const { 422 int RampUpDownUpTester::GetExpectedHighBitrate() const {
423 if (num_audio_streams_ > 0 && num_video_streams_ == 0) 423 int expected_bitrate_bps = 0;
424 return kExpectedHighAudioBitrateBps; 424 if (num_audio_streams_ > 0)
425 return kExpectedHighVideoBitrateBps; 425 expected_bitrate_bps += kExpectedHighAudioBitrateBps;
426 if (num_video_streams_ > 0)
427 expected_bitrate_bps += kExpectedHighVideoBitrateBps;
428 return expected_bitrate_bps;
429 }
430
431 int RampUpDownUpTester::GetHighCapacity() const {
432 return 4 * GetExpectedHighBitrate() / (3 * 1000);
426 } 433 }
427 434
428 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) { 435 void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
429 int64_t now = clock_->TimeInMilliseconds(); 436 int64_t now = clock_->TimeInMilliseconds();
430 switch (test_state_) { 437 switch (test_state_) {
431 case kFirstRampup: { 438 case kFirstRampup: {
432 EXPECT_FALSE(suspended); 439 EXPECT_FALSE(suspended);
433 if (bitrate_bps >= GetExpectedHighBitrate()) { 440 if (bitrate_bps >= GetExpectedHighBitrate()) {
434 // The first ramp-up has reached the target bitrate. Change the 441 // The first ramp-up has reached the target bitrate. Change the
435 // channel limit, and move to the next test state. 442 // channel limit, and move to the next test state.
(...skipping 10 matching lines...) Expand all
446 } 453 }
447 break; 454 break;
448 } 455 }
449 case kLowRate: { 456 case kLowRate: {
450 // Audio streams are never suspended. 457 // Audio streams are never suspended.
451 bool check_suspend_state = num_video_streams_ > 0; 458 bool check_suspend_state = num_video_streams_ > 0;
452 if (bitrate_bps < kExpectedLowBitrateBps && 459 if (bitrate_bps < kExpectedLowBitrateBps &&
453 suspended == check_suspend_state) { 460 suspended == check_suspend_state) {
454 // The ramp-down was successful. Change the channel limit back to a 461 // The ramp-down was successful. Change the channel limit back to a
455 // high value, and move to the next test state. 462 // high value, and move to the next test state.
456 forward_transport_config_.link_capacity_kbps = 463 forward_transport_config_.link_capacity_kbps = GetHighCapacity();
457 kHighBandwidthLimitBps / 1000;
458 send_transport_->SetConfig(forward_transport_config_); 464 send_transport_->SetConfig(forward_transport_config_);
459 test_state_ = kSecondRampup; 465 test_state_ = kSecondRampup;
460 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(), 466 webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
461 "rampdown", now - state_start_ms_, "ms", 467 "rampdown", now - state_start_ms_, "ms",
462 false); 468 false);
463 state_start_ms_ = now; 469 state_start_ms_ = now;
464 interval_start_ms_ = now; 470 interval_start_ms_ = now;
465 sent_bytes_ = 0; 471 sent_bytes_ = 0;
466 } 472 }
467 break; 473 break;
(...skipping 15 matching lines...) Expand all
483 class RampUpTest : public test::CallTest { 489 class RampUpTest : public test::CallTest {
484 public: 490 public:
485 RampUpTest() {} 491 RampUpTest() {}
486 492
487 virtual ~RampUpTest() { 493 virtual ~RampUpTest() {
488 EXPECT_EQ(nullptr, video_send_stream_); 494 EXPECT_EQ(nullptr, video_send_stream_);
489 EXPECT_TRUE(video_receive_streams_.empty()); 495 EXPECT_TRUE(video_receive_streams_.empty());
490 } 496 }
491 }; 497 };
492 498
493 TEST_F(RampUpTest, SingleStream) {
494 RampUpTester test(1, 0, 0, RtpExtension::kTimestampOffsetUri, false, false);
495 RunBaseTest(&test);
496 }
497
498 TEST_F(RampUpTest, Simulcast) {
499 RampUpTester test(3, 0, 0, RtpExtension::kTimestampOffsetUri, false, false);
500 RunBaseTest(&test);
501 }
502
503 TEST_F(RampUpTest, SimulcastWithRtx) {
504 RampUpTester test(3, 0, 0, RtpExtension::kTimestampOffsetUri, true, false);
505 RunBaseTest(&test);
506 }
507
508 TEST_F(RampUpTest, SimulcastByRedWithRtx) {
509 RampUpTester test(3, 0, 0, RtpExtension::kTimestampOffsetUri, true, true);
510 RunBaseTest(&test);
511 }
512
513 TEST_F(RampUpTest, SingleStreamWithHighStartBitrate) {
514 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
515 RtpExtension::kTimestampOffsetUri, false, false);
516 RunBaseTest(&test);
517 }
518
519 static const uint32_t kStartBitrateBps = 60000; 499 static const uint32_t kStartBitrateBps = 60000;
520 500
521 // Disabled: https://bugs.chromium.org/p/webrtc/issues/detail?id=5576 501 TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) {
522 TEST_F(RampUpTest, DISABLED_UpDownUpOneStream) {
523 RampUpDownUpTester test(1, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri,
524 false, false);
525 RunBaseTest(&test);
526 }
527
528 TEST_F(RampUpTest, DISABLED_UpDownUpThreeStreams) {
529 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri,
530 false, false);
531 RunBaseTest(&test);
532 }
533
534 // Disabled: https://bugs.chromium.org/p/webrtc/issues/detail?id=5576
535 TEST_F(RampUpTest, DISABLED_UpDownUpOneStreamRtx) {
536 RampUpDownUpTester test(1, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri,
537 true, false);
538 RunBaseTest(&test);
539 }
540
541 TEST_F(RampUpTest, UpDownUpThreeStreamsRtx) {
542 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri,
543 true, false);
544 RunBaseTest(&test);
545 }
546
547 // Disabled: https://bugs.chromium.org/p/webrtc/issues/detail?id=5576
548 TEST_F(RampUpTest, DISABLED_UpDownUpOneStreamByRedRtx) {
549 RampUpDownUpTester test(1, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri,
550 true, true);
551 RunBaseTest(&test);
552 }
553
554 TEST_F(RampUpTest, UpDownUpThreeStreamsByRedRtx) {
555 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri, 502 RampUpDownUpTester test(3, 0, kStartBitrateBps, RtpExtension::kAbsSendTimeUri,
556 true, true); 503 true, true);
557 RunBaseTest(&test); 504 RunBaseTest(&test);
558 } 505 }
559 506
560 TEST_F(RampUpTest, SendSideVideoUpDownUpRtx) { 507 TEST_F(RampUpTest, UpDownUpTransportSequenceNumberRtx) {
561 RampUpDownUpTester test(3, 0, kStartBitrateBps, 508 RampUpDownUpTester test(3, 0, kStartBitrateBps,
562 RtpExtension::kTransportSequenceNumberUri, true, 509 RtpExtension::kTransportSequenceNumberUri, true,
563 false); 510 false);
564 RunBaseTest(&test); 511 RunBaseTest(&test);
565 } 512 }
566 513
567 // TODO(holmer): Enable when audio bitrates are included in the bitrate 514 TEST_F(RampUpTest, UpDownUpAudioVideoTransportSequenceNumberRtx) {
568 // allocation.
569 TEST_F(RampUpTest, DISABLED_SendSideAudioVideoUpDownUpRtx) {
570 RampUpDownUpTester test(3, 1, kStartBitrateBps, 515 RampUpDownUpTester test(3, 1, kStartBitrateBps,
571 RtpExtension::kTransportSequenceNumberUri, true, 516 RtpExtension::kTransportSequenceNumberUri, true,
572 false); 517 false);
573 RunBaseTest(&test); 518 RunBaseTest(&test);
574 } 519 }
575 520
576 TEST_F(RampUpTest, SendSideAudioOnlyUpDownUpRtx) { 521 TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) {
577 RampUpDownUpTester test(0, 1, kStartBitrateBps, 522 RampUpDownUpTester test(0, 1, kStartBitrateBps,
578 RtpExtension::kTransportSequenceNumberUri, true, 523 RtpExtension::kTransportSequenceNumberUri, true,
579 false); 524 false);
580 RunBaseTest(&test); 525 RunBaseTest(&test);
581 } 526 }
582 527
583 TEST_F(RampUpTest, AbsSendTimeSingleStream) { 528 TEST_F(RampUpTest, TOffsetSimulcastRedRtx) {
529 RampUpTester test(3, 0, 0, RtpExtension::kTimestampOffsetUri, true, true);
530 RunBaseTest(&test);
531 }
532
533 TEST_F(RampUpTest, AbsSendTime) {
584 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTimeUri, false, false); 534 RampUpTester test(1, 0, 0, RtpExtension::kAbsSendTimeUri, false, false);
585 RunBaseTest(&test); 535 RunBaseTest(&test);
586 } 536 }
587 537
588 TEST_F(RampUpTest, AbsSendTimeSimulcast) { 538 TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) {
589 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, false, false);
590 RunBaseTest(&test);
591 }
592
593 TEST_F(RampUpTest, AbsSendTimeSimulcastWithRtx) {
594 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, true, false);
595 RunBaseTest(&test);
596 }
597
598 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) {
599 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, true, true); 539 RampUpTester test(3, 0, 0, RtpExtension::kAbsSendTimeUri, true, true);
600 RunBaseTest(&test); 540 RunBaseTest(&test);
601 } 541 }
602 542
603 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { 543 TEST_F(RampUpTest, TransportSequenceNumber) {
604 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
605 RtpExtension::kAbsSendTimeUri, false, false);
606 RunBaseTest(&test);
607 }
608
609 TEST_F(RampUpTest, TransportSequenceNumberSingleStream) {
610 RampUpTester test(1, 0, 0, RtpExtension::kTransportSequenceNumberUri, false, 544 RampUpTester test(1, 0, 0, RtpExtension::kTransportSequenceNumberUri, false,
611 false); 545 false);
612 RunBaseTest(&test); 546 RunBaseTest(&test);
613 } 547 }
614 548
615 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) { 549 TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
616 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, false, 550 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, false,
617 false); 551 false);
618 RunBaseTest(&test); 552 RunBaseTest(&test);
619 } 553 }
620 554
621 TEST_F(RampUpTest, TransportSequenceNumberSimulcastWithRtx) { 555 TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) {
622 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, true,
623 false);
624 RunBaseTest(&test);
625 }
626
627 TEST_F(RampUpTest, AudioVideoTransportSequenceNumberSimulcastWithRtx) {
628 RampUpTester test(3, 1, 0, RtpExtension::kTransportSequenceNumberUri, true,
629 false);
630 RunBaseTest(&test);
631 }
632
633 TEST_F(RampUpTest, TransportSequenceNumberSimulcastByRedWithRtx) {
634 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, true, 556 RampUpTester test(3, 0, 0, RtpExtension::kTransportSequenceNumberUri, true,
635 true); 557 true);
636 RunBaseTest(&test); 558 RunBaseTest(&test);
637 } 559 }
638
639 TEST_F(RampUpTest, TransportSequenceNumberSingleStreamWithHighStartBitrate) {
640 RampUpTester test(1, 0, 0.9 * kSingleStreamTargetBps,
641 RtpExtension::kTransportSequenceNumberUri, false, false);
642 RunBaseTest(&test);
643 }
644 } // namespace webrtc 560 } // namespace webrtc
OLDNEW
« webrtc/call/rampup_tests.h ('K') | « webrtc/call/rampup_tests.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698