| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" |
| 24 #include "webrtc/test/testsupport/fileutils.h" | 24 #include "webrtc/test/testsupport/fileutils.h" |
| 25 | 25 |
| 26 using std::string; | 26 using std::string; |
| 27 | 27 |
| 28 namespace webrtc { | 28 namespace webrtc { |
| 29 namespace testing { | 29 namespace testing { |
| 30 namespace bwe { | 30 namespace bwe { |
| 31 | 31 |
| 32 class DefaultBweTest : public BweTest, | |
| 33 public ::testing::TestWithParam<BandwidthEstimatorType> { | |
| 34 public: | |
| 35 virtual ~DefaultBweTest() {} | |
| 36 }; | |
| 37 | |
| 38 INSTANTIATE_TEST_CASE_P(VideoSendersTest, | |
| 39 DefaultBweTest, | |
| 40 ::testing::Values(kRembEstimator, | |
| 41 kFullSendSideEstimator)); | |
| 42 | |
| 43 TEST_P(DefaultBweTest, UnlimitedSpeed) { | |
| 44 VideoSource source(0, 30, 300, 0, 0); | |
| 45 VideoSender sender(&uplink_, &source, GetParam()); | |
| 46 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 47 RunFor(10 * 60 * 1000); | |
| 48 } | |
| 49 | |
| 50 TEST_P(DefaultBweTest, SteadyLoss) { | |
| 51 VideoSource source(0, 30, 300, 0, 0); | |
| 52 VideoSender sender(&uplink_, &source, GetParam()); | |
| 53 LossFilter loss(&uplink_, 0); | |
| 54 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 55 loss.SetLoss(20.0); | |
| 56 RunFor(10 * 60 * 1000); | |
| 57 } | |
| 58 | |
| 59 TEST_P(DefaultBweTest, IncreasingLoss1) { | |
| 60 VideoSource source(0, 30, 300, 0, 0); | |
| 61 VideoSender sender(&uplink_, &source, GetParam()); | |
| 62 LossFilter loss(&uplink_, 0); | |
| 63 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 64 for (int i = 0; i < 76; ++i) { | |
| 65 loss.SetLoss(i); | |
| 66 RunFor(5000); | |
| 67 } | |
| 68 } | |
| 69 | |
| 70 TEST_P(DefaultBweTest, SteadyDelay) { | |
| 71 VideoSource source(0, 30, 300, 0, 0); | |
| 72 VideoSender sender(&uplink_, &source, GetParam()); | |
| 73 DelayFilter delay(&uplink_, 0); | |
| 74 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 75 delay.SetOneWayDelayMs(1000); | |
| 76 RunFor(10 * 60 * 1000); | |
| 77 } | |
| 78 | |
| 79 TEST_P(DefaultBweTest, IncreasingDelay1) { | |
| 80 VideoSource source(0, 30, 300, 0, 0); | |
| 81 VideoSender sender(&uplink_, &source, GetParam()); | |
| 82 DelayFilter delay(&uplink_, 0); | |
| 83 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 84 RunFor(10 * 60 * 1000); | |
| 85 for (int i = 0; i < 30 * 2; ++i) { | |
| 86 delay.SetOneWayDelayMs(i); | |
| 87 RunFor(10 * 1000); | |
| 88 } | |
| 89 RunFor(10 * 60 * 1000); | |
| 90 } | |
| 91 | |
| 92 TEST_P(DefaultBweTest, IncreasingDelay2) { | |
| 93 VideoSource source(0, 30, 300, 0, 0); | |
| 94 VideoSender sender(&uplink_, &source, GetParam()); | |
| 95 DelayFilter delay(&uplink_, 0); | |
| 96 RateCounterFilter counter(&uplink_, 0, "", ""); | |
| 97 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 98 RunFor(1 * 60 * 1000); | |
| 99 for (int i = 1; i < 51; ++i) { | |
| 100 delay.SetOneWayDelayMs(10.0f * i); | |
| 101 RunFor(10 * 1000); | |
| 102 } | |
| 103 delay.SetOneWayDelayMs(0.0f); | |
| 104 RunFor(10 * 60 * 1000); | |
| 105 } | |
| 106 | |
| 107 TEST_P(DefaultBweTest, JumpyDelay1) { | |
| 108 VideoSource source(0, 30, 300, 0, 0); | |
| 109 VideoSender sender(&uplink_, &source, GetParam()); | |
| 110 DelayFilter delay(&uplink_, 0); | |
| 111 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 112 RunFor(10 * 60 * 1000); | |
| 113 for (int i = 1; i < 200; ++i) { | |
| 114 delay.SetOneWayDelayMs((10 * i) % 500); | |
| 115 RunFor(1000); | |
| 116 delay.SetOneWayDelayMs(1.0f); | |
| 117 RunFor(1000); | |
| 118 } | |
| 119 delay.SetOneWayDelayMs(0.0f); | |
| 120 RunFor(10 * 60 * 1000); | |
| 121 } | |
| 122 | |
| 123 TEST_P(DefaultBweTest, SteadyJitter) { | |
| 124 VideoSource source(0, 30, 300, 0, 0); | |
| 125 VideoSender sender(&uplink_, &source, GetParam()); | |
| 126 JitterFilter jitter(&uplink_, 0); | |
| 127 RateCounterFilter counter(&uplink_, 0, "", ""); | |
| 128 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 129 jitter.SetMaxJitter(20); | |
| 130 RunFor(2 * 60 * 1000); | |
| 131 } | |
| 132 | |
| 133 TEST_P(DefaultBweTest, IncreasingJitter1) { | |
| 134 VideoSource source(0, 30, 300, 0, 0); | |
| 135 VideoSender sender(&uplink_, &source, GetParam()); | |
| 136 JitterFilter jitter(&uplink_, 0); | |
| 137 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 138 for (int i = 0; i < 2 * 60 * 2; ++i) { | |
| 139 jitter.SetMaxJitter(i); | |
| 140 RunFor(10 * 1000); | |
| 141 } | |
| 142 RunFor(10 * 60 * 1000); | |
| 143 } | |
| 144 | |
| 145 TEST_P(DefaultBweTest, IncreasingJitter2) { | |
| 146 VideoSource source(0, 30, 300, 0, 0); | |
| 147 VideoSender sender(&uplink_, &source, GetParam()); | |
| 148 JitterFilter jitter(&uplink_, 0); | |
| 149 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 150 RunFor(30 * 1000); | |
| 151 for (int i = 1; i < 51; ++i) { | |
| 152 jitter.SetMaxJitter(10.0f * i); | |
| 153 RunFor(10 * 1000); | |
| 154 } | |
| 155 jitter.SetMaxJitter(0.0f); | |
| 156 RunFor(10 * 60 * 1000); | |
| 157 } | |
| 158 | |
| 159 TEST_P(DefaultBweTest, SteadyReorder) { | |
| 160 VideoSource source(0, 30, 300, 0, 0); | |
| 161 VideoSender sender(&uplink_, &source, GetParam()); | |
| 162 ReorderFilter reorder(&uplink_, 0); | |
| 163 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 164 reorder.SetReorder(20.0); | |
| 165 RunFor(10 * 60 * 1000); | |
| 166 } | |
| 167 | |
| 168 TEST_P(DefaultBweTest, IncreasingReorder1) { | |
| 169 VideoSource source(0, 30, 300, 0, 0); | |
| 170 VideoSender sender(&uplink_, &source, GetParam()); | |
| 171 ReorderFilter reorder(&uplink_, 0); | |
| 172 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 173 for (int i = 0; i < 76; ++i) { | |
| 174 reorder.SetReorder(i); | |
| 175 RunFor(5000); | |
| 176 } | |
| 177 } | |
| 178 | |
| 179 TEST_P(DefaultBweTest, SteadyChoke) { | |
| 180 VideoSource source(0, 30, 300, 0, 0); | |
| 181 VideoSender sender(&uplink_, &source, GetParam()); | |
| 182 ChokeFilter choke(&uplink_, 0); | |
| 183 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 184 choke.set_capacity_kbps(140); | |
| 185 RunFor(10 * 60 * 1000); | |
| 186 } | |
| 187 | |
| 188 TEST_P(DefaultBweTest, IncreasingChoke1) { | |
| 189 VideoSource source(0, 30, 300, 0, 0); | |
| 190 VideoSender sender(&uplink_, &source, GetParam()); | |
| 191 ChokeFilter choke(&uplink_, 0); | |
| 192 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 193 for (int i = 1200; i >= 100; i -= 100) { | |
| 194 choke.set_capacity_kbps(i); | |
| 195 RunFor(5000); | |
| 196 } | |
| 197 } | |
| 198 | |
| 199 TEST_P(DefaultBweTest, IncreasingChoke2) { | |
| 200 VideoSource source(0, 30, 300, 0, 0); | |
| 201 VideoSender sender(&uplink_, &source, GetParam()); | |
| 202 ChokeFilter choke(&uplink_, 0); | |
| 203 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 204 RunFor(60 * 1000); | |
| 205 for (int i = 1200; i >= 100; i -= 20) { | |
| 206 choke.set_capacity_kbps(i); | |
| 207 RunFor(1000); | |
| 208 } | |
| 209 } | |
| 210 | |
| 211 TEST_P(DefaultBweTest, Multi1) { | |
| 212 VideoSource source(0, 30, 300, 0, 0); | |
| 213 VideoSender sender(&uplink_, &source, GetParam()); | |
| 214 DelayFilter delay(&uplink_, 0); | |
| 215 ChokeFilter choke(&uplink_, 0); | |
| 216 RateCounterFilter counter(&uplink_, 0, "", ""); | |
| 217 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 218 choke.set_capacity_kbps(1000); | |
| 219 RunFor(1 * 60 * 1000); | |
| 220 for (int i = 1; i < 51; ++i) { | |
| 221 delay.SetOneWayDelayMs(100.0f * i); | |
| 222 RunFor(10 * 1000); | |
| 223 } | |
| 224 RunFor(500 * 1000); | |
| 225 delay.SetOneWayDelayMs(0.0f); | |
| 226 RunFor(5 * 60 * 1000); | |
| 227 } | |
| 228 | |
| 229 TEST_P(DefaultBweTest, Multi2) { | |
| 230 VideoSource source(0, 30, 300, 0, 0); | |
| 231 VideoSender sender(&uplink_, &source, GetParam()); | |
| 232 ChokeFilter choke(&uplink_, 0); | |
| 233 JitterFilter jitter(&uplink_, 0); | |
| 234 RateCounterFilter counter(&uplink_, 0, "", ""); | |
| 235 PacketReceiver receiver(&uplink_, 0, GetParam(), false, false); | |
| 236 choke.set_capacity_kbps(2000); | |
| 237 jitter.SetMaxJitter(120); | |
| 238 RunFor(5 * 60 * 1000); | |
| 239 } | |
| 240 | |
| 241 // This test fixture is used to instantiate tests running with adaptive video | 32 // This test fixture is used to instantiate tests running with adaptive video |
| 242 // senders. | 33 // senders. |
| 243 class BweFeedbackTest | 34 class BweFeedbackTest |
| 244 : public BweTest, | 35 : public BweTest, |
| 245 public ::testing::TestWithParam<BandwidthEstimatorType> { | 36 public ::testing::TestWithParam<BandwidthEstimatorType> { |
| 246 public: | 37 public: |
| 247 #ifdef WEBRTC_WIN | 38 #ifdef WEBRTC_WIN |
| 248 BweFeedbackTest() | 39 BweFeedbackTest() |
| 249 : BweTest(), random_(Clock::GetRealTimeClock()->TimeInMicroseconds()) {} | 40 : BweTest(), random_(Clock::GetRealTimeClock()->TimeInMicroseconds()) {} |
| 250 #else | 41 #else |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 for (int i = 0; i < 2; ++i) { | 220 for (int i = 0; i < 2; ++i) { |
| 430 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); | 221 offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000)); |
| 431 } | 222 } |
| 432 | 223 |
| 433 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 1000, kRttMs, kMaxJitterMs, | 224 RunFairnessTest(GetParam(), 1, 1, 300, 2000, 1000, kRttMs, kMaxJitterMs, |
| 434 offset_ms); | 225 offset_ms); |
| 435 } | 226 } |
| 436 } // namespace bwe | 227 } // namespace bwe |
| 437 } // namespace testing | 228 } // namespace testing |
| 438 } // namespace webrtc | 229 } // namespace webrtc |
| OLD | NEW |