| 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 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" |
| 12 | 12 |
| 13 #include <memory> |
| 13 #include <sstream> | 14 #include <sstream> |
| 14 | 15 |
| 15 #include "webrtc/base/arraysize.h" | 16 #include "webrtc/base/arraysize.h" |
| 16 #include "webrtc/base/common.h" | 17 #include "webrtc/base/common.h" |
| 17 #include "webrtc/base/scoped_ptr.h" | |
| 18 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
| 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" |
| 21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" |
| 22 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" |
| 23 #include "webrtc/system_wrappers/include/clock.h" | 23 #include "webrtc/system_wrappers/include/clock.h" |
| 24 #include "webrtc/test/testsupport/perf_test.h" | 24 #include "webrtc/test/testsupport/perf_test.h" |
| 25 | 25 |
| 26 using std::string; | 26 using std::string; |
| 27 using std::vector; | 27 using std::vector; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 for (MetricRecorder* recorder : metric_recorders) | 548 for (MetricRecorder* recorder : metric_recorders) |
| 549 delete recorder; | 549 delete recorder; |
| 550 for (PacketReceiver* receiver : receivers) | 550 for (PacketReceiver* receiver : receivers) |
| 551 delete receiver; | 551 delete receiver; |
| 552 } | 552 } |
| 553 | 553 |
| 554 // 5.3. Bi-directional RMCAT flows. | 554 // 5.3. Bi-directional RMCAT flows. |
| 555 void BweTest::RunBidirectionalFlow(BandwidthEstimatorType bwe_type) { | 555 void BweTest::RunBidirectionalFlow(BandwidthEstimatorType bwe_type) { |
| 556 enum direction { kForward = 0, kBackward }; | 556 enum direction { kForward = 0, kBackward }; |
| 557 const size_t kNumFlows = 2; | 557 const size_t kNumFlows = 2; |
| 558 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; | 558 std::unique_ptr<AdaptiveVideoSource> sources[kNumFlows]; |
| 559 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; | 559 std::unique_ptr<VideoSender> senders[kNumFlows]; |
| 560 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; | 560 std::unique_ptr<MetricRecorder> metric_recorders[kNumFlows]; |
| 561 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; | 561 std::unique_ptr<PacketReceiver> receivers[kNumFlows]; |
| 562 | 562 |
| 563 sources[kForward].reset(new AdaptiveVideoSource(kForward, 30, 300, 0, 0)); | 563 sources[kForward].reset(new AdaptiveVideoSource(kForward, 30, 300, 0, 0)); |
| 564 senders[kForward].reset( | 564 senders[kForward].reset( |
| 565 new VideoSender(&uplink_, sources[kForward].get(), bwe_type)); | 565 new VideoSender(&uplink_, sources[kForward].get(), bwe_type)); |
| 566 | 566 |
| 567 sources[kBackward].reset(new AdaptiveVideoSource(kBackward, 30, 300, 0, 0)); | 567 sources[kBackward].reset(new AdaptiveVideoSource(kBackward, 30, 300, 0, 0)); |
| 568 senders[kBackward].reset( | 568 senders[kBackward].reset( |
| 569 new VideoSender(&downlink_, sources[kBackward].get(), bwe_type)); | 569 new VideoSender(&downlink_, sources[kBackward].get(), bwe_type)); |
| 570 | 570 |
| 571 DefaultEvaluationFilter up_filter(&uplink_, kForward); | 571 DefaultEvaluationFilter up_filter(&uplink_, kForward); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 RunFairnessTest(bwe_type, kNumRmcatFlows, kNumTcpFlows, kRunTimeS, | 657 RunFairnessTest(bwe_type, kNumRmcatFlows, kNumTcpFlows, kRunTimeS, |
| 658 kLinkCapacity, max_delay_ms, rtt_ms, kMaxJitterMs, offsets_ms, | 658 kLinkCapacity, max_delay_ms, rtt_ms, kMaxJitterMs, offsets_ms, |
| 659 title, bwe_names[bwe_type]); | 659 title, bwe_names[bwe_type]); |
| 660 } | 660 } |
| 661 | 661 |
| 662 // 5.5. Five competing RMCAT flows under different RTTs. | 662 // 5.5. Five competing RMCAT flows under different RTTs. |
| 663 void BweTest::RunRoundTripTimeFairness(BandwidthEstimatorType bwe_type) { | 663 void BweTest::RunRoundTripTimeFairness(BandwidthEstimatorType bwe_type) { |
| 664 const int kAllFlowIds[] = {0, 1, 2, 3, 4}; // Five RMCAT flows. | 664 const int kAllFlowIds[] = {0, 1, 2, 3, 4}; // Five RMCAT flows. |
| 665 const int64_t kAllOneWayDelayMs[] = {10, 25, 50, 100, 150}; | 665 const int64_t kAllOneWayDelayMs[] = {10, 25, 50, 100, 150}; |
| 666 const size_t kNumFlows = arraysize(kAllFlowIds); | 666 const size_t kNumFlows = arraysize(kAllFlowIds); |
| 667 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; | 667 std::unique_ptr<AdaptiveVideoSource> sources[kNumFlows]; |
| 668 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; | 668 std::unique_ptr<VideoSender> senders[kNumFlows]; |
| 669 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; | 669 std::unique_ptr<MetricRecorder> metric_recorders[kNumFlows]; |
| 670 | 670 |
| 671 // Flows initialized 10 seconds apart. | 671 // Flows initialized 10 seconds apart. |
| 672 const int64_t kStartingApartMs = 10 * 1000; | 672 const int64_t kStartingApartMs = 10 * 1000; |
| 673 | 673 |
| 674 for (size_t i = 0; i < kNumFlows; ++i) { | 674 for (size_t i = 0; i < kNumFlows; ++i) { |
| 675 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, | 675 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, |
| 676 i * kStartingApartMs)); | 676 i * kStartingApartMs)); |
| 677 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), bwe_type)); | 677 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), bwe_type)); |
| 678 } | 678 } |
| 679 | 679 |
| 680 ChokeFilter choke_filter(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); | 680 ChokeFilter choke_filter(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); |
| 681 LinkShare link_share(&choke_filter); | 681 LinkShare link_share(&choke_filter); |
| 682 | 682 |
| 683 JitterFilter jitter_filter(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); | 683 JitterFilter jitter_filter(&uplink_, CreateFlowIds(kAllFlowIds, kNumFlows)); |
| 684 | 684 |
| 685 rtc::scoped_ptr<DelayFilter> up_delay_filters[kNumFlows]; | 685 std::unique_ptr<DelayFilter> up_delay_filters[kNumFlows]; |
| 686 for (size_t i = 0; i < kNumFlows; ++i) { | 686 for (size_t i = 0; i < kNumFlows; ++i) { |
| 687 up_delay_filters[i].reset(new DelayFilter(&uplink_, kAllFlowIds[i])); | 687 up_delay_filters[i].reset(new DelayFilter(&uplink_, kAllFlowIds[i])); |
| 688 } | 688 } |
| 689 | 689 |
| 690 RateCounterFilter total_utilization( | 690 RateCounterFilter total_utilization( |
| 691 &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "Total_utilization", | 691 &uplink_, CreateFlowIds(kAllFlowIds, kNumFlows), "Total_utilization", |
| 692 "Total_link_utilization"); | 692 "Total_link_utilization"); |
| 693 | 693 |
| 694 // Delays is being plotted only for the first flow. | 694 // Delays is being plotted only for the first flow. |
| 695 // To plot all of them, replace "i == 0" with "true" on new PacketReceiver(). | 695 // To plot all of them, replace "i == 0" with "true" on new PacketReceiver(). |
| 696 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; | 696 std::unique_ptr<PacketReceiver> receivers[kNumFlows]; |
| 697 for (size_t i = 0; i < kNumFlows; ++i) { | 697 for (size_t i = 0; i < kNumFlows; ++i) { |
| 698 metric_recorders[i].reset( | 698 metric_recorders[i].reset( |
| 699 new MetricRecorder(bwe_names[bwe_type], static_cast<int>(i), | 699 new MetricRecorder(bwe_names[bwe_type], static_cast<int>(i), |
| 700 senders[i].get(), &link_share)); | 700 senders[i].get(), &link_share)); |
| 701 | 701 |
| 702 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], bwe_type, | 702 receivers[i].reset(new PacketReceiver(&uplink_, kAllFlowIds[i], bwe_type, |
| 703 i == 0, false, | 703 i == 0, false, |
| 704 metric_recorders[i].get())); | 704 metric_recorders[i].get())); |
| 705 metric_recorders[i].get()->set_start_computing_metrics_ms(kStartingApartMs * | 705 metric_recorders[i].get()->set_start_computing_metrics_ms(kStartingApartMs * |
| 706 (kNumFlows - 1)); | 706 (kNumFlows - 1)); |
| 707 metric_recorders[i].get()->set_plot_available_capacity( | 707 metric_recorders[i].get()->set_plot_available_capacity( |
| 708 i == 0 && plot_total_available_capacity_); | 708 i == 0 && plot_total_available_capacity_); |
| 709 } | 709 } |
| 710 | 710 |
| 711 rtc::scoped_ptr<DelayFilter> down_delay_filters[kNumFlows]; | 711 std::unique_ptr<DelayFilter> down_delay_filters[kNumFlows]; |
| 712 for (size_t i = 0; i < kNumFlows; ++i) { | 712 for (size_t i = 0; i < kNumFlows; ++i) { |
| 713 down_delay_filters[i].reset(new DelayFilter(&downlink_, kAllFlowIds[i])); | 713 down_delay_filters[i].reset(new DelayFilter(&downlink_, kAllFlowIds[i])); |
| 714 } | 714 } |
| 715 | 715 |
| 716 jitter_filter.SetMaxJitter(kMaxJitterMs); | 716 jitter_filter.SetMaxJitter(kMaxJitterMs); |
| 717 choke_filter.set_max_delay_ms(kMaxQueueingDelayMs); | 717 choke_filter.set_max_delay_ms(kMaxQueueingDelayMs); |
| 718 | 718 |
| 719 for (size_t i = 0; i < kNumFlows; ++i) { | 719 for (size_t i = 0; i < kNumFlows; ++i) { |
| 720 up_delay_filters[i]->SetOneWayDelayMs(kAllOneWayDelayMs[i]); | 720 up_delay_filters[i]->SetOneWayDelayMs(kAllOneWayDelayMs[i]); |
| 721 down_delay_filters[i]->SetOneWayDelayMs(kAllOneWayDelayMs[i]); | 721 down_delay_filters[i]->SetOneWayDelayMs(kAllOneWayDelayMs[i]); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // Two RMCAT flows and ten TCP flows. | 773 // Two RMCAT flows and ten TCP flows. |
| 774 const int kAllRmcatFlowIds[] = {0, 1}; | 774 const int kAllRmcatFlowIds[] = {0, 1}; |
| 775 const int kAllTcpFlowIds[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; | 775 const int kAllTcpFlowIds[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; |
| 776 | 776 |
| 777 assert(tcp_starting_times_ms.size() == tcp_file_sizes_bytes.size() && | 777 assert(tcp_starting_times_ms.size() == tcp_file_sizes_bytes.size() && |
| 778 tcp_starting_times_ms.size() == arraysize(kAllTcpFlowIds)); | 778 tcp_starting_times_ms.size() == arraysize(kAllTcpFlowIds)); |
| 779 | 779 |
| 780 const size_t kNumRmcatFlows = arraysize(kAllRmcatFlowIds); | 780 const size_t kNumRmcatFlows = arraysize(kAllRmcatFlowIds); |
| 781 const size_t kNumTotalFlows = kNumRmcatFlows + arraysize(kAllTcpFlowIds); | 781 const size_t kNumTotalFlows = kNumRmcatFlows + arraysize(kAllTcpFlowIds); |
| 782 | 782 |
| 783 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumRmcatFlows]; | 783 std::unique_ptr<AdaptiveVideoSource> sources[kNumRmcatFlows]; |
| 784 rtc::scoped_ptr<PacketSender> senders[kNumTotalFlows]; | 784 std::unique_ptr<PacketSender> senders[kNumTotalFlows]; |
| 785 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumTotalFlows]; | 785 std::unique_ptr<MetricRecorder> metric_recorders[kNumTotalFlows]; |
| 786 rtc::scoped_ptr<PacketReceiver> receivers[kNumTotalFlows]; | 786 std::unique_ptr<PacketReceiver> receivers[kNumTotalFlows]; |
| 787 | 787 |
| 788 // RMCAT Flows are initialized simultaneosly at t=5 seconds. | 788 // RMCAT Flows are initialized simultaneosly at t=5 seconds. |
| 789 const int64_t kRmcatStartingTimeMs = 5 * 1000; | 789 const int64_t kRmcatStartingTimeMs = 5 * 1000; |
| 790 for (size_t id : kAllRmcatFlowIds) { | 790 for (size_t id : kAllRmcatFlowIds) { |
| 791 sources[id].reset(new AdaptiveVideoSource(static_cast<int>(id), 30, 300, 0, | 791 sources[id].reset(new AdaptiveVideoSource(static_cast<int>(id), 30, 300, 0, |
| 792 kRmcatStartingTimeMs)); | 792 kRmcatStartingTimeMs)); |
| 793 senders[id].reset(new VideoSender(&uplink_, sources[id].get(), bwe_type)); | 793 senders[id].reset(new VideoSender(&uplink_, sources[id].get(), bwe_type)); |
| 794 } | 794 } |
| 795 | 795 |
| 796 for (size_t id : kAllTcpFlowIds) { | 796 for (size_t id : kAllTcpFlowIds) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 BWE_TEST_LOGGING_BASELINEBAR(5, bwe_names[bwe_type], kOneWayDelayMs, id); | 865 BWE_TEST_LOGGING_BASELINEBAR(5, bwe_names[bwe_type], kOneWayDelayMs, id); |
| 866 } | 866 } |
| 867 } | 867 } |
| 868 | 868 |
| 869 // 5.8. Three forward direction competing flows, constant capacity. | 869 // 5.8. Three forward direction competing flows, constant capacity. |
| 870 // During the test, one of the flows is paused and later resumed. | 870 // During the test, one of the flows is paused and later resumed. |
| 871 void BweTest::RunPauseResumeFlows(BandwidthEstimatorType bwe_type) { | 871 void BweTest::RunPauseResumeFlows(BandwidthEstimatorType bwe_type) { |
| 872 const int kAllFlowIds[] = {0, 1, 2}; // Three RMCAT flows. | 872 const int kAllFlowIds[] = {0, 1, 2}; // Three RMCAT flows. |
| 873 const size_t kNumFlows = arraysize(kAllFlowIds); | 873 const size_t kNumFlows = arraysize(kAllFlowIds); |
| 874 | 874 |
| 875 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; | 875 std::unique_ptr<AdaptiveVideoSource> sources[kNumFlows]; |
| 876 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; | 876 std::unique_ptr<VideoSender> senders[kNumFlows]; |
| 877 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; | 877 std::unique_ptr<MetricRecorder> metric_recorders[kNumFlows]; |
| 878 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; | 878 std::unique_ptr<PacketReceiver> receivers[kNumFlows]; |
| 879 | 879 |
| 880 // Flows initialized simultaneously. | 880 // Flows initialized simultaneously. |
| 881 const int64_t kStartingApartMs = 0; | 881 const int64_t kStartingApartMs = 0; |
| 882 | 882 |
| 883 for (size_t i = 0; i < kNumFlows; ++i) { | 883 for (size_t i = 0; i < kNumFlows; ++i) { |
| 884 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, | 884 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, |
| 885 i * kStartingApartMs)); | 885 i * kStartingApartMs)); |
| 886 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), bwe_type)); | 886 senders[i].reset(new VideoSender(&uplink_, sources[i].get(), bwe_type)); |
| 887 } | 887 } |
| 888 | 888 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 tcp_starting_times_ms.push_back( | 975 tcp_starting_times_ms.push_back( |
| 976 static_cast<int64_t>(random.Exponential(1.0f / kMeanMs))); | 976 static_cast<int64_t>(random.Exponential(1.0f / kMeanMs))); |
| 977 } | 977 } |
| 978 | 978 |
| 979 return tcp_starting_times_ms; | 979 return tcp_starting_times_ms; |
| 980 } | 980 } |
| 981 | 981 |
| 982 } // namespace bwe | 982 } // namespace bwe |
| 983 } // namespace testing | 983 } // namespace testing |
| 984 } // namespace webrtc | 984 } // namespace webrtc |
| OLD | NEW |