| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1); | 112 IncomingFeedback(now_ms, send_time_ms, seq_num++, 1000, kPacingInfo1); |
| 113 } | 113 } |
| 114 | 114 |
| 115 EXPECT_TRUE(bitrate_observer_.updated()); | 115 EXPECT_TRUE(bitrate_observer_.updated()); |
| 116 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u); | 116 EXPECT_NEAR(bitrate_observer_.latest_bitrate(), 4000000u, 10000u); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TEST_F(DelayBasedBweTest, GetProbingInterval) { | 119 TEST_F(DelayBasedBweTest, GetProbingInterval) { |
| 120 int64_t default_interval_ms = bitrate_estimator_->GetProbingIntervalMs(); | 120 int64_t default_interval_ms = bitrate_estimator_->GetProbingIntervalMs(); |
| 121 EXPECT_GT(default_interval_ms, 0); | 121 EXPECT_GT(default_interval_ms, 0); |
| 122 CapacityDropTestHelper(1, true, 567, 0); | 122 CapacityDropTestHelper(1, true, 333, 0); |
| 123 int64_t interval_ms = bitrate_estimator_->GetProbingIntervalMs(); | 123 int64_t interval_ms = bitrate_estimator_->GetProbingIntervalMs(); |
| 124 EXPECT_GT(interval_ms, 0); | 124 EXPECT_GT(interval_ms, 0); |
| 125 EXPECT_NE(interval_ms, default_interval_ms); | 125 EXPECT_NE(interval_ms, default_interval_ms); |
| 126 } | 126 } |
| 127 | 127 |
| 128 TEST_F(DelayBasedBweTest, InitialBehavior) { | 128 TEST_F(DelayBasedBweTest, InitialBehavior) { |
| 129 InitialBehaviorTestHelper(674840); | 129 InitialBehaviorTestHelper(674840); |
| 130 } | 130 } |
| 131 | 131 |
| 132 TEST_F(DelayBasedBweTest, RateIncreaseReordering) { | 132 TEST_F(DelayBasedBweTest, RateIncreaseReordering) { |
| 133 RateIncreaseReorderingTestHelper(674840); | 133 RateIncreaseReorderingTestHelper(674840); |
| 134 } | 134 } |
| 135 | |
| 136 TEST_F(DelayBasedBweTest, RateIncreaseRtpTimestamps) { | 135 TEST_F(DelayBasedBweTest, RateIncreaseRtpTimestamps) { |
| 137 RateIncreaseRtpTimestampsTestHelper(1240); | 136 RateIncreaseRtpTimestampsTestHelper(1288); |
| 138 } | 137 } |
| 139 | 138 |
| 140 TEST_F(DelayBasedBweTest, CapacityDropOneStream) { | 139 TEST_F(DelayBasedBweTest, CapacityDropOneStream) { |
| 141 CapacityDropTestHelper(1, false, 567, 0); | 140 CapacityDropTestHelper(1, false, 333, 0); |
| 142 } | 141 } |
| 143 | 142 |
| 144 TEST_F(DelayBasedBweTest, CapacityDropPosOffsetChange) { | 143 TEST_F(DelayBasedBweTest, CapacityDropPosOffsetChange) { |
| 145 CapacityDropTestHelper(1, false, 200, 30000); | 144 CapacityDropTestHelper(1, false, 867, 30000); |
| 146 } | 145 } |
| 147 | 146 |
| 148 TEST_F(DelayBasedBweTest, CapacityDropNegOffsetChange) { | 147 TEST_F(DelayBasedBweTest, CapacityDropNegOffsetChange) { |
| 149 CapacityDropTestHelper(1, false, 733, -30000); | 148 CapacityDropTestHelper(1, false, 867, -30000); |
| 150 } | 149 } |
| 151 | 150 |
| 152 TEST_F(DelayBasedBweTest, CapacityDropOneStreamWrap) { | 151 TEST_F(DelayBasedBweTest, CapacityDropOneStreamWrap) { |
| 153 CapacityDropTestHelper(1, true, 567, 0); | 152 CapacityDropTestHelper(1, true, 333, 0); |
| 154 } | 153 } |
| 155 | |
| 156 TEST_F(DelayBasedBweTest, TestTimestampGrouping) { | 154 TEST_F(DelayBasedBweTest, TestTimestampGrouping) { |
| 157 TestTimestampGroupingTestHelper(); | 155 TestTimestampGroupingTestHelper(); |
| 158 } | 156 } |
| 159 | 157 |
| 160 TEST_F(DelayBasedBweTest, TestShortTimeoutAndWrap) { | 158 TEST_F(DelayBasedBweTest, TestShortTimeoutAndWrap) { |
| 161 // Simulate a client leaving and rejoining the call after 35 seconds. This | 159 // Simulate a client leaving and rejoining the call after 35 seconds. This |
| 162 // will make abs send time wrap, so if streams aren't timed out properly | 160 // will make abs send time wrap, so if streams aren't timed out properly |
| 163 // the next 30 seconds of packets will be out of order. | 161 // the next 30 seconds of packets will be out of order. |
| 164 TestWrappingHelper(35); | 162 TestWrappingHelper(35); |
| 165 } | 163 } |
| 166 | 164 |
| 167 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { | 165 TEST_F(DelayBasedBweTest, TestLongTimeoutAndWrap) { |
| 168 // Simulate a client leaving and rejoining the call after some multiple of | 166 // Simulate a client leaving and rejoining the call after some multiple of |
| 169 // 64 seconds later. This will cause a zero difference in abs send times due | 167 // 64 seconds later. This will cause a zero difference in abs send times due |
| 170 // to the wrap, but a big difference in arrival time, if streams aren't | 168 // to the wrap, but a big difference in arrival time, if streams aren't |
| 171 // properly timed out. | 169 // properly timed out. |
| 172 TestWrappingHelper(10 * 64); | 170 TestWrappingHelper(10 * 64); |
| 173 } | 171 } |
| 174 | 172 |
| 175 class DelayBasedBweExperimentTest : public DelayBasedBweTest { | |
| 176 public: | |
| 177 DelayBasedBweExperimentTest() | |
| 178 : override_field_trials_("WebRTC-ImprovedBitrateEstimate/Enabled/") { | |
| 179 bitrate_estimator_.reset(new DelayBasedBwe(nullptr, &clock_)); | |
| 180 } | |
| 181 | |
| 182 private: | |
| 183 test::ScopedFieldTrials override_field_trials_; | |
| 184 }; | |
| 185 | |
| 186 TEST_F(DelayBasedBweExperimentTest, RateIncreaseRtpTimestamps) { | |
| 187 RateIncreaseRtpTimestampsTestHelper(1288); | |
| 188 } | |
| 189 | |
| 190 TEST_F(DelayBasedBweExperimentTest, CapacityDropOneStream) { | |
| 191 CapacityDropTestHelper(1, false, 333, 0); | |
| 192 } | |
| 193 | |
| 194 TEST_F(DelayBasedBweExperimentTest, CapacityDropPosOffsetChange) { | |
| 195 CapacityDropTestHelper(1, false, 300, 30000); | |
| 196 } | |
| 197 | |
| 198 TEST_F(DelayBasedBweExperimentTest, CapacityDropNegOffsetChange) { | |
| 199 CapacityDropTestHelper(1, false, 300, -30000); | |
| 200 } | |
| 201 | |
| 202 TEST_F(DelayBasedBweExperimentTest, CapacityDropOneStreamWrap) { | |
| 203 CapacityDropTestHelper(1, true, 333, 0); | |
| 204 } | |
| 205 | |
| 206 class DelayBasedBweTrendlineExperimentTest : public DelayBasedBweTest { | |
| 207 public: | |
| 208 DelayBasedBweTrendlineExperimentTest() | |
| 209 : override_field_trials_("WebRTC-BweTrendlineFilter/Enabled-15,0.9,4/") { | |
| 210 bitrate_estimator_.reset(new DelayBasedBwe(nullptr, &clock_)); | |
| 211 } | |
| 212 | |
| 213 private: | |
| 214 test::ScopedFieldTrials override_field_trials_; | |
| 215 }; | |
| 216 | |
| 217 TEST_F(DelayBasedBweTrendlineExperimentTest, RateIncreaseRtpTimestamps) { | |
| 218 RateIncreaseRtpTimestampsTestHelper(1240); | |
| 219 } | |
| 220 | |
| 221 TEST_F(DelayBasedBweTrendlineExperimentTest, CapacityDropOneStream) { | |
| 222 CapacityDropTestHelper(1, false, 600, 0); | |
| 223 } | |
| 224 | |
| 225 TEST_F(DelayBasedBweTrendlineExperimentTest, CapacityDropPosOffsetChange) { | |
| 226 CapacityDropTestHelper(1, false, 600, 30000); | |
| 227 } | |
| 228 | |
| 229 TEST_F(DelayBasedBweTrendlineExperimentTest, CapacityDropNegOffsetChange) { | |
| 230 CapacityDropTestHelper(1, false, 1267, -30000); | |
| 231 } | |
| 232 | |
| 233 TEST_F(DelayBasedBweTrendlineExperimentTest, CapacityDropOneStreamWrap) { | |
| 234 CapacityDropTestHelper(1, true, 600, 0); | |
| 235 } | |
| 236 | |
| 237 class DelayBasedBweMedianSlopeExperimentTest : public DelayBasedBweTest { | |
| 238 public: | |
| 239 DelayBasedBweMedianSlopeExperimentTest() | |
| 240 : override_field_trials_("WebRTC-BweMedianSlopeFilter/Enabled-20,4/") { | |
| 241 bitrate_estimator_.reset(new DelayBasedBwe(nullptr, &clock_)); | |
| 242 } | |
| 243 | |
| 244 private: | |
| 245 test::ScopedFieldTrials override_field_trials_; | |
| 246 }; | |
| 247 | |
| 248 TEST_F(DelayBasedBweMedianSlopeExperimentTest, RateIncreaseRtpTimestamps) { | |
| 249 RateIncreaseRtpTimestampsTestHelper(1240); | |
| 250 } | |
| 251 | |
| 252 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropOneStream) { | |
| 253 CapacityDropTestHelper(1, false, 600, 0); | |
| 254 } | |
| 255 | |
| 256 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropPosOffsetChange) { | |
| 257 CapacityDropTestHelper(1, false, 600, 30000); | |
| 258 } | |
| 259 | |
| 260 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropNegOffsetChange) { | |
| 261 CapacityDropTestHelper(1, false, 1267, -30000); | |
| 262 } | |
| 263 | |
| 264 TEST_F(DelayBasedBweMedianSlopeExperimentTest, CapacityDropOneStreamWrap) { | |
| 265 CapacityDropTestHelper(1, true, 600, 0); | |
| 266 } | |
| 267 | |
| 268 } // namespace webrtc | 173 } // namespace webrtc |
| OLD | NEW |