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 <sstream> | 13 #include <sstream> |
14 | 14 |
| 15 #include "webrtc/base/arraysize.h" |
15 #include "webrtc/base/common.h" | 16 #include "webrtc/base/common.h" |
16 #include "webrtc/base/scoped_ptr.h" | 17 #include "webrtc/base/scoped_ptr.h" |
17 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" |
19 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" |
20 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" |
21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" |
22 #include "webrtc/system_wrappers/include/clock.h" | 23 #include "webrtc/system_wrappers/include/clock.h" |
23 #include "webrtc/test/testsupport/perf_test.h" | 24 #include "webrtc/test/testsupport/perf_test.h" |
24 | 25 |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 // Test also with one way propagation delay = 100ms. | 656 // Test also with one way propagation delay = 100ms. |
656 RunFairnessTest(bwe_type, kNumRmcatFlows, kNumTcpFlows, kRunTimeS, | 657 RunFairnessTest(bwe_type, kNumRmcatFlows, kNumTcpFlows, kRunTimeS, |
657 kLinkCapacity, max_delay_ms, rtt_ms, kMaxJitterMs, offsets_ms, | 658 kLinkCapacity, max_delay_ms, rtt_ms, kMaxJitterMs, offsets_ms, |
658 title, bwe_names[bwe_type]); | 659 title, bwe_names[bwe_type]); |
659 } | 660 } |
660 | 661 |
661 // 5.5. Five competing RMCAT flows under different RTTs. | 662 // 5.5. Five competing RMCAT flows under different RTTs. |
662 void BweTest::RunRoundTripTimeFairness(BandwidthEstimatorType bwe_type) { | 663 void BweTest::RunRoundTripTimeFairness(BandwidthEstimatorType bwe_type) { |
663 const int kAllFlowIds[] = {0, 1, 2, 3, 4}; // Five RMCAT flows. | 664 const int kAllFlowIds[] = {0, 1, 2, 3, 4}; // Five RMCAT flows. |
664 const int64_t kAllOneWayDelayMs[] = {10, 25, 50, 100, 150}; | 665 const int64_t kAllOneWayDelayMs[] = {10, 25, 50, 100, 150}; |
665 const size_t kNumFlows = ARRAY_SIZE(kAllFlowIds); | 666 const size_t kNumFlows = arraysize(kAllFlowIds); |
666 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; | 667 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; |
667 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; | 668 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; |
668 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; | 669 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; |
669 | 670 |
670 // Flows initialized 10 seconds apart. | 671 // Flows initialized 10 seconds apart. |
671 const int64_t kStartingApartMs = 10 * 1000; | 672 const int64_t kStartingApartMs = 10 * 1000; |
672 | 673 |
673 for (size_t i = 0; i < kNumFlows; ++i) { | 674 for (size_t i = 0; i < kNumFlows; ++i) { |
674 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, | 675 sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, |
675 i * kStartingApartMs)); | 676 i * kStartingApartMs)); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 // 5.7. RMCAT Flows competing with multiple short TCP Flows. | 768 // 5.7. RMCAT Flows competing with multiple short TCP Flows. |
768 void BweTest::RunMultipleShortTcpFairness( | 769 void BweTest::RunMultipleShortTcpFairness( |
769 BandwidthEstimatorType bwe_type, | 770 BandwidthEstimatorType bwe_type, |
770 std::vector<int> tcp_file_sizes_bytes, | 771 std::vector<int> tcp_file_sizes_bytes, |
771 std::vector<int64_t> tcp_starting_times_ms) { | 772 std::vector<int64_t> tcp_starting_times_ms) { |
772 // Two RMCAT flows and ten TCP flows. | 773 // Two RMCAT flows and ten TCP flows. |
773 const int kAllRmcatFlowIds[] = {0, 1}; | 774 const int kAllRmcatFlowIds[] = {0, 1}; |
774 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}; |
775 | 776 |
776 assert(tcp_starting_times_ms.size() == tcp_file_sizes_bytes.size() && | 777 assert(tcp_starting_times_ms.size() == tcp_file_sizes_bytes.size() && |
777 tcp_starting_times_ms.size() == ARRAY_SIZE(kAllTcpFlowIds)); | 778 tcp_starting_times_ms.size() == arraysize(kAllTcpFlowIds)); |
778 | 779 |
779 const size_t kNumRmcatFlows = ARRAY_SIZE(kAllRmcatFlowIds); | 780 const size_t kNumRmcatFlows = arraysize(kAllRmcatFlowIds); |
780 const size_t kNumTotalFlows = kNumRmcatFlows + ARRAY_SIZE(kAllTcpFlowIds); | 781 const size_t kNumTotalFlows = kNumRmcatFlows + arraysize(kAllTcpFlowIds); |
781 | 782 |
782 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumRmcatFlows]; | 783 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumRmcatFlows]; |
783 rtc::scoped_ptr<PacketSender> senders[kNumTotalFlows]; | 784 rtc::scoped_ptr<PacketSender> senders[kNumTotalFlows]; |
784 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumTotalFlows]; | 785 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumTotalFlows]; |
785 rtc::scoped_ptr<PacketReceiver> receivers[kNumTotalFlows]; | 786 rtc::scoped_ptr<PacketReceiver> receivers[kNumTotalFlows]; |
786 | 787 |
787 // RMCAT Flows are initialized simultaneosly at t=5 seconds. | 788 // RMCAT Flows are initialized simultaneosly at t=5 seconds. |
788 const int64_t kRmcatStartingTimeMs = 5 * 1000; | 789 const int64_t kRmcatStartingTimeMs = 5 * 1000; |
789 for (size_t id : kAllRmcatFlowIds) { | 790 for (size_t id : kAllRmcatFlowIds) { |
790 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, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 title, bwe_names[bwe_type], kNumRmcatFlows, | 863 title, bwe_names[bwe_type], kNumRmcatFlows, |
863 receivers[id].get()->GlobalPacketLoss()); | 864 receivers[id].get()->GlobalPacketLoss()); |
864 BWE_TEST_LOGGING_BASELINEBAR(5, bwe_names[bwe_type], kOneWayDelayMs, id); | 865 BWE_TEST_LOGGING_BASELINEBAR(5, bwe_names[bwe_type], kOneWayDelayMs, id); |
865 } | 866 } |
866 } | 867 } |
867 | 868 |
868 // 5.8. Three forward direction competing flows, constant capacity. | 869 // 5.8. Three forward direction competing flows, constant capacity. |
869 // 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. |
870 void BweTest::RunPauseResumeFlows(BandwidthEstimatorType bwe_type) { | 871 void BweTest::RunPauseResumeFlows(BandwidthEstimatorType bwe_type) { |
871 const int kAllFlowIds[] = {0, 1, 2}; // Three RMCAT flows. | 872 const int kAllFlowIds[] = {0, 1, 2}; // Three RMCAT flows. |
872 const size_t kNumFlows = ARRAY_SIZE(kAllFlowIds); | 873 const size_t kNumFlows = arraysize(kAllFlowIds); |
873 | 874 |
874 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; | 875 rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows]; |
875 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; | 876 rtc::scoped_ptr<VideoSender> senders[kNumFlows]; |
876 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; | 877 rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows]; |
877 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; | 878 rtc::scoped_ptr<PacketReceiver> receivers[kNumFlows]; |
878 | 879 |
879 // Flows initialized simultaneously. | 880 // Flows initialized simultaneously. |
880 const int64_t kStartingApartMs = 0; | 881 const int64_t kStartingApartMs = 0; |
881 | 882 |
882 for (size_t i = 0; i < kNumFlows; ++i) { | 883 for (size_t i = 0; i < kNumFlows; ++i) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 tcp_starting_times_ms.push_back( | 975 tcp_starting_times_ms.push_back( |
975 static_cast<int64_t>(random.Exponential(1.0f / kMeanMs))); | 976 static_cast<int64_t>(random.Exponential(1.0f / kMeanMs))); |
976 } | 977 } |
977 | 978 |
978 return tcp_starting_times_ms; | 979 return tcp_starting_times_ms; |
979 } | 980 } |
980 | 981 |
981 } // namespace bwe | 982 } // namespace bwe |
982 } // namespace testing | 983 } // namespace testing |
983 } // namespace webrtc | 984 } // namespace webrtc |
OLD | NEW |