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 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "webrtc/test/frame_generator_capturer.h" | 33 #include "webrtc/test/frame_generator_capturer.h" |
34 #include "webrtc/test/statistics.h" | 34 #include "webrtc/test/statistics.h" |
35 #include "webrtc/test/testsupport/fileutils.h" | 35 #include "webrtc/test/testsupport/fileutils.h" |
36 #include "webrtc/typedefs.h" | 36 #include "webrtc/typedefs.h" |
37 | 37 |
38 namespace webrtc { | 38 namespace webrtc { |
39 | 39 |
40 static const int kFullStackTestDurationSecs = 60; | 40 static const int kFullStackTestDurationSecs = 60; |
41 static const int kSendStatsPollingIntervalMs = 1000; | 41 static const int kSendStatsPollingIntervalMs = 1000; |
42 | 42 |
| 43 enum class ContentMode { |
| 44 kRealTimeVideo, |
| 45 kScreensharingStaticImage, |
| 46 kScreensharingScrollingImage, |
| 47 }; |
| 48 |
43 struct FullStackTestParams { | 49 struct FullStackTestParams { |
44 const char* test_label; | 50 const char* test_label; |
45 struct { | 51 struct { |
46 const char* name; | 52 const char* name; |
47 size_t width, height; | 53 size_t width, height; |
48 int fps; | 54 int fps; |
49 } clip; | 55 } clip; |
50 bool screenshare; | 56 ContentMode mode; |
51 int min_bitrate_bps; | 57 int min_bitrate_bps; |
52 int target_bitrate_bps; | 58 int target_bitrate_bps; |
53 int max_bitrate_bps; | 59 int max_bitrate_bps; |
54 double avg_psnr_threshold; | 60 double avg_psnr_threshold; |
55 double avg_ssim_threshold; | 61 double avg_ssim_threshold; |
56 int test_durations_secs; | 62 int test_durations_secs; |
57 std::string codec; | 63 std::string codec; |
58 FakeNetworkPipe::Config link; | 64 FakeNetworkPipe::Config link; |
59 }; | 65 }; |
60 | 66 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 VideoStream* stream = &encoder_config_.streams[0]; | 530 VideoStream* stream = &encoder_config_.streams[0]; |
525 stream->width = params.clip.width; | 531 stream->width = params.clip.width; |
526 stream->height = params.clip.height; | 532 stream->height = params.clip.height; |
527 stream->min_bitrate_bps = params.min_bitrate_bps; | 533 stream->min_bitrate_bps = params.min_bitrate_bps; |
528 stream->target_bitrate_bps = params.target_bitrate_bps; | 534 stream->target_bitrate_bps = params.target_bitrate_bps; |
529 stream->max_bitrate_bps = params.max_bitrate_bps; | 535 stream->max_bitrate_bps = params.max_bitrate_bps; |
530 stream->max_framerate = params.clip.fps; | 536 stream->max_framerate = params.clip.fps; |
531 | 537 |
532 VideoCodecVP8 vp8_settings; | 538 VideoCodecVP8 vp8_settings; |
533 VideoCodecVP9 vp9_settings; | 539 VideoCodecVP9 vp9_settings; |
534 if (params.screenshare) { | 540 if (params.mode == ContentMode::kScreensharingStaticImage || |
| 541 params.mode == ContentMode::kScreensharingScrollingImage) { |
535 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; | 542 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; |
536 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; | 543 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; |
537 if (params.codec == "VP8") { | 544 if (params.codec == "VP8") { |
538 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 545 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
539 vp8_settings.denoisingOn = false; | 546 vp8_settings.denoisingOn = false; |
540 vp8_settings.frameDroppingOn = false; | 547 vp8_settings.frameDroppingOn = false; |
541 vp8_settings.numberOfTemporalLayers = 2; | 548 vp8_settings.numberOfTemporalLayers = 2; |
542 encoder_config_.encoder_specific_settings = &vp8_settings; | 549 encoder_config_.encoder_specific_settings = &vp8_settings; |
543 } else if (params.codec == "VP9") { | 550 } else if (params.codec == "VP9") { |
544 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 551 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
(...skipping 13 matching lines...) Expand all Loading... |
558 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; | 565 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; |
559 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = | 566 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = |
560 kSendRtxPayloadType; | 567 kSendRtxPayloadType; |
561 | 568 |
562 for (auto& config : receive_configs_) | 569 for (auto& config : receive_configs_) |
563 config.pre_decode_callback = &analyzer; | 570 config.pre_decode_callback = &analyzer; |
564 CreateStreams(); | 571 CreateStreams(); |
565 analyzer.input_ = send_stream_->Input(); | 572 analyzer.input_ = send_stream_->Input(); |
566 analyzer.send_stream_ = send_stream_; | 573 analyzer.send_stream_ = send_stream_; |
567 | 574 |
568 if (params.screenshare) { | 575 std::vector<std::string> slides; |
569 std::vector<std::string> slides; | 576 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
570 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); | 577 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
571 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); | 578 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
572 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); | 579 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
573 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); | 580 size_t kSlidesWidth = 1850; |
| 581 size_t kSlidesHeight = 1110; |
574 | 582 |
575 rtc::scoped_ptr<test::FrameGenerator> frame_generator( | 583 Clock* clock = Clock::GetRealTimeClock(); |
576 test::FrameGenerator::CreateFromYuvFile( | 584 rtc::scoped_ptr<test::FrameGenerator> frame_generator; |
577 slides, 1850, 1110, | |
578 10 * params.clip.fps) // Cycle image every 10 seconds. | |
579 ); | |
580 frame_generator_capturer_.reset(new test::FrameGeneratorCapturer( | |
581 Clock::GetRealTimeClock(), &analyzer, frame_generator.release(), | |
582 params.clip.fps)); | |
583 ASSERT_TRUE(frame_generator_capturer_->Init()); | |
584 } else { | |
585 frame_generator_capturer_.reset( | |
586 test::FrameGeneratorCapturer::CreateFromYuvFile( | |
587 &analyzer, test::ResourcePath(params.clip.name, "yuv"), | |
588 params.clip.width, params.clip.height, params.clip.fps, | |
589 Clock::GetRealTimeClock())); | |
590 | 585 |
591 ASSERT_TRUE(frame_generator_capturer_.get() != nullptr) | 586 switch (params.mode) { |
592 << "Could not create capturer for " << params.clip.name | 587 case ContentMode::kRealTimeVideo: |
593 << ".yuv. Is this resource file present?"; | 588 frame_generator.reset(test::FrameGenerator::CreateFromYuvFile( |
| 589 std::vector<std::string>(1, |
| 590 test::ResourcePath(params.clip.name, "yuv")), |
| 591 params.clip.width, params.clip.height, 1)); |
| 592 break; |
| 593 case ContentMode::kScreensharingScrollingImage: |
| 594 frame_generator.reset( |
| 595 test::FrameGenerator::CreateScrollingInputFromYuvFiles( |
| 596 clock, slides, kSlidesWidth, kSlidesHeight, params.clip.width, |
| 597 params.clip.height, 2000, |
| 598 8000)); // Scroll for 2 seconds, then pause for 8. |
| 599 break; |
| 600 case ContentMode::kScreensharingStaticImage: |
| 601 frame_generator.reset(test::FrameGenerator::CreateFromYuvFile( |
| 602 slides, kSlidesWidth, kSlidesHeight, |
| 603 10 * params.clip.fps)); // Cycle image every 10 seconds. |
| 604 break; |
594 } | 605 } |
595 | 606 |
| 607 ASSERT_TRUE(frame_generator.get() != nullptr); |
| 608 frame_generator_capturer_.reset(new test::FrameGeneratorCapturer( |
| 609 clock, &analyzer, frame_generator.release(), params.clip.fps)); |
| 610 ASSERT_TRUE(frame_generator_capturer_->Init()); |
| 611 |
596 Start(); | 612 Start(); |
597 | 613 |
598 analyzer.Wait(); | 614 analyzer.Wait(); |
599 | 615 |
600 send_transport.StopSending(); | 616 send_transport.StopSending(); |
601 recv_transport.StopSending(); | 617 recv_transport.StopSending(); |
602 | 618 |
603 Stop(); | 619 Stop(); |
604 | 620 |
605 DestroyStreams(); | 621 DestroyStreams(); |
606 } | 622 } |
607 | 623 |
608 TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { | 624 TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { |
609 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", | 625 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", |
610 {"paris_qcif", 176, 144, 30}, | 626 {"paris_qcif", 176, 144, 30}, |
611 false, | 627 ContentMode::kRealTimeVideo, |
612 300000, | 628 300000, |
613 300000, | 629 300000, |
614 300000, | 630 300000, |
615 36.0, | 631 36.0, |
616 0.96, | 632 0.96, |
617 kFullStackTestDurationSecs, | 633 kFullStackTestDurationSecs, |
618 "VP8"}; | 634 "VP8"}; |
619 RunTest(paris_qcif); | 635 RunTest(paris_qcif); |
620 } | 636 } |
621 | 637 |
622 TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { | 638 TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { |
623 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. | 639 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. |
624 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", | 640 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", |
625 {"foreman_cif", 352, 288, 30}, | 641 {"foreman_cif", 352, 288, 30}, |
626 false, | 642 ContentMode::kRealTimeVideo, |
627 700000, | 643 700000, |
628 700000, | 644 700000, |
629 700000, | 645 700000, |
630 0.0, | 646 0.0, |
631 0.0, | 647 0.0, |
632 kFullStackTestDurationSecs, | 648 kFullStackTestDurationSecs, |
633 "VP8"}; | 649 "VP8"}; |
634 RunTest(foreman_cif); | 650 RunTest(foreman_cif); |
635 } | 651 } |
636 | 652 |
637 TEST_F(FullStackTest, ForemanCifPlr5) { | 653 TEST_F(FullStackTest, ForemanCifPlr5) { |
638 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", | 654 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", |
639 {"foreman_cif", 352, 288, 30}, | 655 {"foreman_cif", 352, 288, 30}, |
640 false, | 656 ContentMode::kRealTimeVideo, |
641 30000, | 657 30000, |
642 500000, | 658 500000, |
643 2000000, | 659 2000000, |
644 0.0, | 660 0.0, |
645 0.0, | 661 0.0, |
646 kFullStackTestDurationSecs, | 662 kFullStackTestDurationSecs, |
647 "VP8"}; | 663 "VP8"}; |
648 foreman_cif.link.loss_percent = 5; | 664 foreman_cif.link.loss_percent = 5; |
649 foreman_cif.link.queue_delay_ms = 50; | 665 foreman_cif.link.queue_delay_ms = 50; |
650 RunTest(foreman_cif); | 666 RunTest(foreman_cif); |
651 } | 667 } |
652 | 668 |
653 TEST_F(FullStackTest, ForemanCif500kbps) { | 669 TEST_F(FullStackTest, ForemanCif500kbps) { |
654 FullStackTestParams foreman_cif = {"foreman_cif_500kbps", | 670 FullStackTestParams foreman_cif = {"foreman_cif_500kbps", |
655 {"foreman_cif", 352, 288, 30}, | 671 {"foreman_cif", 352, 288, 30}, |
656 false, | 672 ContentMode::kRealTimeVideo, |
657 30000, | 673 30000, |
658 500000, | 674 500000, |
659 2000000, | 675 2000000, |
660 0.0, | 676 0.0, |
661 0.0, | 677 0.0, |
662 kFullStackTestDurationSecs, | 678 kFullStackTestDurationSecs, |
663 "VP8"}; | 679 "VP8"}; |
664 foreman_cif.link.queue_length_packets = 0; | 680 foreman_cif.link.queue_length_packets = 0; |
665 foreman_cif.link.queue_delay_ms = 0; | 681 foreman_cif.link.queue_delay_ms = 0; |
666 foreman_cif.link.link_capacity_kbps = 500; | 682 foreman_cif.link.link_capacity_kbps = 500; |
667 RunTest(foreman_cif); | 683 RunTest(foreman_cif); |
668 } | 684 } |
669 | 685 |
670 TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { | 686 TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { |
671 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", | 687 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", |
672 {"foreman_cif", 352, 288, 30}, | 688 {"foreman_cif", 352, 288, 30}, |
673 false, | 689 ContentMode::kRealTimeVideo, |
674 30000, | 690 30000, |
675 500000, | 691 500000, |
676 2000000, | 692 2000000, |
677 0.0, | 693 0.0, |
678 0.0, | 694 0.0, |
679 kFullStackTestDurationSecs, | 695 kFullStackTestDurationSecs, |
680 "VP8"}; | 696 "VP8"}; |
681 foreman_cif.link.queue_length_packets = 32; | 697 foreman_cif.link.queue_length_packets = 32; |
682 foreman_cif.link.queue_delay_ms = 0; | 698 foreman_cif.link.queue_delay_ms = 0; |
683 foreman_cif.link.link_capacity_kbps = 500; | 699 foreman_cif.link.link_capacity_kbps = 500; |
684 RunTest(foreman_cif); | 700 RunTest(foreman_cif); |
685 } | 701 } |
686 | 702 |
687 TEST_F(FullStackTest, ForemanCif500kbps100ms) { | 703 TEST_F(FullStackTest, ForemanCif500kbps100ms) { |
688 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", | 704 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", |
689 {"foreman_cif", 352, 288, 30}, | 705 {"foreman_cif", 352, 288, 30}, |
690 false, | 706 ContentMode::kRealTimeVideo, |
691 30000, | 707 30000, |
692 500000, | 708 500000, |
693 2000000, | 709 2000000, |
694 0.0, | 710 0.0, |
695 0.0, | 711 0.0, |
696 kFullStackTestDurationSecs, | 712 kFullStackTestDurationSecs, |
697 "VP8"}; | 713 "VP8"}; |
698 foreman_cif.link.queue_length_packets = 0; | 714 foreman_cif.link.queue_length_packets = 0; |
699 foreman_cif.link.queue_delay_ms = 100; | 715 foreman_cif.link.queue_delay_ms = 100; |
700 foreman_cif.link.link_capacity_kbps = 500; | 716 foreman_cif.link.link_capacity_kbps = 500; |
701 RunTest(foreman_cif); | 717 RunTest(foreman_cif); |
702 } | 718 } |
703 | 719 |
704 TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { | 720 TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { |
705 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", | 721 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", |
706 {"foreman_cif", 352, 288, 30}, | 722 {"foreman_cif", 352, 288, 30}, |
707 false, | 723 ContentMode::kRealTimeVideo, |
708 30000, | 724 30000, |
709 500000, | 725 500000, |
710 2000000, | 726 2000000, |
711 0.0, | 727 0.0, |
712 0.0, | 728 0.0, |
713 kFullStackTestDurationSecs, | 729 kFullStackTestDurationSecs, |
714 "VP8"}; | 730 "VP8"}; |
715 foreman_cif.link.queue_length_packets = 32; | 731 foreman_cif.link.queue_length_packets = 32; |
716 foreman_cif.link.queue_delay_ms = 100; | 732 foreman_cif.link.queue_delay_ms = 100; |
717 foreman_cif.link.link_capacity_kbps = 500; | 733 foreman_cif.link.link_capacity_kbps = 500; |
718 RunTest(foreman_cif); | 734 RunTest(foreman_cif); |
719 } | 735 } |
720 | 736 |
721 TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { | 737 TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { |
722 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", | 738 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", |
723 {"foreman_cif", 352, 288, 30}, | 739 {"foreman_cif", 352, 288, 30}, |
724 false, | 740 ContentMode::kRealTimeVideo, |
725 30000, | 741 30000, |
726 2000000, | 742 2000000, |
727 2000000, | 743 2000000, |
728 0.0, | 744 0.0, |
729 0.0, | 745 0.0, |
730 kFullStackTestDurationSecs, | 746 kFullStackTestDurationSecs, |
731 "VP8"}; | 747 "VP8"}; |
732 foreman_cif.link.queue_length_packets = 32; | 748 foreman_cif.link.queue_length_packets = 32; |
733 foreman_cif.link.queue_delay_ms = 100; | 749 foreman_cif.link.queue_delay_ms = 100; |
734 foreman_cif.link.link_capacity_kbps = 1000; | 750 foreman_cif.link.link_capacity_kbps = 1000; |
735 RunTest(foreman_cif); | 751 RunTest(foreman_cif); |
736 } | 752 } |
737 | 753 |
738 // Temporarily disabled on Android due to low test timeouts. | 754 // Temporarily disabled on Android due to low test timeouts. |
739 // https://code.google.com/p/chromium/issues/detail?id=513170 | 755 // https://code.google.com/p/chromium/issues/detail?id=513170 |
740 #include "webrtc/test/testsupport/gtest_disable.h" | 756 #include "webrtc/test/testsupport/gtest_disable.h" |
741 TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL)) { | 757 TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL)) { |
742 FullStackTestParams screenshare_params = { | 758 FullStackTestParams screenshare_params = { |
743 "screenshare_slides", | 759 "screenshare_slides", |
744 {"screenshare_slides", 1850, 1110, 5}, | 760 {"screenshare_slides", 1850, 1110, 5}, |
745 true, | 761 ContentMode::kScreensharingStaticImage, |
746 50000, | 762 50000, |
747 200000, | 763 200000, |
748 2000000, | 764 2000000, |
| 765 0.0, |
| 766 0.0, |
| 767 kFullStackTestDurationSecs, |
| 768 "VP8"}; |
| 769 RunTest(screenshare_params); |
| 770 } |
| 771 |
| 772 TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL_Scroll)) { |
| 773 FullStackTestParams screenshare_params = { |
| 774 "screenshare_slides_scrolling", |
| 775 // Crop height by two, scrolling vertically only. |
| 776 {"screenshare_slides_scrolling", 1850, 1110 / 2, 5}, |
| 777 ContentMode::kScreensharingScrollingImage, |
| 778 50000, |
| 779 200000, |
| 780 2000000, |
749 0.0, | 781 0.0, |
750 0.0, | 782 0.0, |
751 kFullStackTestDurationSecs, | 783 kFullStackTestDurationSecs, |
752 "VP8"}; | 784 "VP8"}; |
753 RunTest(screenshare_params); | 785 RunTest(screenshare_params); |
754 } | 786 } |
755 | 787 |
756 // Disabled on Android along with VP8 screenshare above. | 788 // Disabled on Android along with VP8 screenshare above. |
757 TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP9_2TL)) { | 789 TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP9_2TL)) { |
758 FullStackTestParams screenshare_params = { | 790 FullStackTestParams screenshare_params = { |
759 "screenshare_slides_vp9_2tl", | 791 "screenshare_slides_vp9_2tl", |
760 {"screenshare_slides", 1850, 1110, 5}, | 792 {"screenshare_slides", 1850, 1110, 5}, |
761 true, | 793 ContentMode::kScreensharingStaticImage, |
762 50000, | 794 50000, |
763 200000, | 795 200000, |
764 2000000, | 796 2000000, |
765 0.0, | 797 0.0, |
766 0.0, | 798 0.0, |
767 kFullStackTestDurationSecs, | 799 kFullStackTestDurationSecs, |
768 "VP9"}; | 800 "VP9"}; |
769 RunTest(screenshare_params); | 801 RunTest(screenshare_params); |
770 } | 802 } |
771 } // namespace webrtc | 803 } // namespace webrtc |
OLD | NEW |