| 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 <memory> |
| 14 #include <sstream> | 14 #include <sstream> |
| 15 | 15 |
| 16 #include "webrtc/base/arraysize.h" | 16 #include "webrtc/base/arraysize.h" |
| 17 #include "webrtc/modules/include/module_common_types.h" | 17 #include "webrtc/modules/include/module_common_types.h" |
| 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" |
| 19 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" |
| 21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" |
| 22 #include "webrtc/system_wrappers/include/clock.h" | 22 #include "webrtc/system_wrappers/include/clock.h" |
| 23 #include "webrtc/test/testsupport/perf_test.h" | 23 #include "webrtc/test/testsupport/perf_test.h" |
| 24 | 24 |
| 25 using std::string; | |
| 26 using std::vector; | 25 using std::vector; |
| 27 | 26 |
| 28 namespace webrtc { | 27 namespace webrtc { |
| 29 namespace testing { | 28 namespace testing { |
| 30 namespace bwe { | 29 namespace bwe { |
| 31 | 30 |
| 32 PacketProcessorRunner::PacketProcessorRunner(PacketProcessor* processor) | 31 PacketProcessorRunner::PacketProcessorRunner(PacketProcessor* processor) |
| 33 : processor_(processor) { | 32 : processor_(processor) { |
| 34 } | 33 } |
| 35 | 34 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 105 } |
| 107 | 106 |
| 108 BweTest::~BweTest() { | 107 BweTest::~BweTest() { |
| 109 for (Packet* packet : packets_) | 108 for (Packet* packet : packets_) |
| 110 delete packet; | 109 delete packet; |
| 111 } | 110 } |
| 112 | 111 |
| 113 void BweTest::SetUp() { | 112 void BweTest::SetUp() { |
| 114 const ::testing::TestInfo* const test_info = | 113 const ::testing::TestInfo* const test_info = |
| 115 ::testing::UnitTest::GetInstance()->current_test_info(); | 114 ::testing::UnitTest::GetInstance()->current_test_info(); |
| 116 string test_name = | 115 std::string test_name = |
| 117 string(test_info->test_case_name()) + "_" + string(test_info->name()); | 116 std::string(test_info->test_case_name()) + "_" + |
| 117 std::string(test_info->name()); |
| 118 BWE_TEST_LOGGING_GLOBAL_CONTEXT(test_name); | 118 BWE_TEST_LOGGING_GLOBAL_CONTEXT(test_name); |
| 119 BWE_TEST_LOGGING_GLOBAL_ENABLE(false); | 119 BWE_TEST_LOGGING_GLOBAL_ENABLE(false); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void Link::AddPacketProcessor(PacketProcessor* processor, | 122 void Link::AddPacketProcessor(PacketProcessor* processor, |
| 123 ProcessorType processor_type) { | 123 ProcessorType processor_type) { |
| 124 assert(processor); | 124 assert(processor); |
| 125 switch (processor_type) { | 125 switch (processor_type) { |
| 126 case kSender: | 126 case kSender: |
| 127 senders_.push_back(static_cast<PacketSender*>(processor)); | 127 senders_.push_back(static_cast<PacketSender*>(processor)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 time_now_ms_ += simulation_interval_ms_) { | 174 time_now_ms_ += simulation_interval_ms_) { |
| 175 // Packets are first generated on the first link, passed through all the | 175 // Packets are first generated on the first link, passed through all the |
| 176 // PacketProcessors and PacketReceivers. The PacketReceivers produces | 176 // PacketProcessors and PacketReceivers. The PacketReceivers produces |
| 177 // FeedbackPackets which are then processed by the next link, where they | 177 // FeedbackPackets which are then processed by the next link, where they |
| 178 // at some point will be consumed by a PacketSender. | 178 // at some point will be consumed by a PacketSender. |
| 179 for (Link* link : links_) | 179 for (Link* link : links_) |
| 180 link->Run(simulation_interval_ms_, time_now_ms_, &packets_); | 180 link->Run(simulation_interval_ms_, time_now_ms_, &packets_); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 string BweTest::GetTestName() const { | 184 std::string BweTest::GetTestName() const { |
| 185 const ::testing::TestInfo* const test_info = | 185 const ::testing::TestInfo* const test_info = |
| 186 ::testing::UnitTest::GetInstance()->current_test_info(); | 186 ::testing::UnitTest::GetInstance()->current_test_info(); |
| 187 return string(test_info->name()); | 187 return std::string(test_info->name()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void BweTest::PrintResults(double max_throughput_kbps, | 190 void BweTest::PrintResults(double max_throughput_kbps, |
| 191 Stats<double> throughput_kbps, | 191 Stats<double> throughput_kbps, |
| 192 int flow_id, | 192 int flow_id, |
| 193 Stats<double> flow_delay_ms, | 193 Stats<double> flow_delay_ms, |
| 194 Stats<double> flow_throughput_kbps) { | 194 Stats<double> flow_throughput_kbps) { |
| 195 std::map<int, Stats<double>> flow_delays_ms; | 195 std::map<int, Stats<double>> flow_delays_ms; |
| 196 flow_delays_ms[flow_id] = flow_delay_ms; | 196 flow_delays_ms[flow_id] = flow_delay_ms; |
| 197 std::map<int, Stats<double>> flow_throughputs_kbps; | 197 std::map<int, Stats<double>> flow_throughputs_kbps; |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 tcp_starting_times_ms.push_back( | 974 tcp_starting_times_ms.push_back( |
| 975 static_cast<int64_t>(random.Exponential(1.0f / kMeanMs))); | 975 static_cast<int64_t>(random.Exponential(1.0f / kMeanMs))); |
| 976 } | 976 } |
| 977 | 977 |
| 978 return tcp_starting_times_ms; | 978 return tcp_starting_times_ms; |
| 979 } | 979 } |
| 980 | 980 |
| 981 } // namespace bwe | 981 } // namespace bwe |
| 982 } // namespace testing | 982 } // namespace testing |
| 983 } // namespace webrtc | 983 } // namespace webrtc |
| OLD | NEW |