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 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h
" | 10 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h
" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 ++i; | 144 ++i; |
145 } | 145 } |
146 it = std::min_element(streams_.begin(), streams_.end(), RtpStream::Compare); | 146 it = std::min_element(streams_.begin(), streams_.end(), RtpStream::Compare); |
147 return std::max((*it)->next_rtp_time(), time_now_us); | 147 return std::max((*it)->next_rtp_time(), time_now_us); |
148 } | 148 } |
149 } // namespace test | 149 } // namespace test |
150 | 150 |
151 DelayBasedBweTest::DelayBasedBweTest() | 151 DelayBasedBweTest::DelayBasedBweTest() |
152 : clock_(100000000), | 152 : clock_(100000000), |
153 acknowledged_bitrate_estimator_( | 153 acknowledged_bitrate_estimator_( |
154 rtc::MakeUnique<AcknowledgedBitrateEstimator>()), | 154 rtc::MakeUnique<AcknowledgedBitrateEstimator>( |
| 155 rtc::MakeUnique<BitrateEstimatorCreator>())), |
155 bitrate_estimator_(new DelayBasedBwe(nullptr, &clock_)), | 156 bitrate_estimator_(new DelayBasedBwe(nullptr, &clock_)), |
156 stream_generator_(new test::StreamGenerator(1e6, // Capacity. | 157 stream_generator_(new test::StreamGenerator(1e6, // Capacity. |
157 clock_.TimeInMicroseconds())), | 158 clock_.TimeInMicroseconds())), |
158 arrival_time_offset_ms_(0), | 159 arrival_time_offset_ms_(0), |
159 first_update_(true) {} | 160 first_update_(true) {} |
160 | 161 |
161 DelayBasedBweTest::~DelayBasedBweTest() {} | 162 DelayBasedBweTest::~DelayBasedBweTest() {} |
162 | 163 |
163 void DelayBasedBweTest::AddDefaultStream() { | 164 void DelayBasedBweTest::AddDefaultStream() { |
164 stream_generator_->AddStream(new test::RtpStream(30, 3e5)); | 165 stream_generator_->AddStream(new test::RtpStream(30, 3e5)); |
(...skipping 12 matching lines...) Expand all Loading... |
177 void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms, | 178 void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms, |
178 int64_t send_time_ms, | 179 int64_t send_time_ms, |
179 uint16_t sequence_number, | 180 uint16_t sequence_number, |
180 size_t payload_size, | 181 size_t payload_size, |
181 const PacedPacketInfo& pacing_info) { | 182 const PacedPacketInfo& pacing_info) { |
182 RTC_CHECK_GE(arrival_time_ms + arrival_time_offset_ms_, 0); | 183 RTC_CHECK_GE(arrival_time_ms + arrival_time_offset_ms_, 0); |
183 PacketFeedback packet(arrival_time_ms + arrival_time_offset_ms_, send_time_ms, | 184 PacketFeedback packet(arrival_time_ms + arrival_time_offset_ms_, send_time_ms, |
184 sequence_number, payload_size, pacing_info); | 185 sequence_number, payload_size, pacing_info); |
185 std::vector<PacketFeedback> packets; | 186 std::vector<PacketFeedback> packets; |
186 packets.push_back(packet); | 187 packets.push_back(packet); |
187 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector(packets); | 188 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector(packets, false); |
188 DelayBasedBwe::Result result = | 189 DelayBasedBwe::Result result = |
189 bitrate_estimator_->IncomingPacketFeedbackVector( | 190 bitrate_estimator_->IncomingPacketFeedbackVector( |
190 packets, acknowledged_bitrate_estimator_->bitrate_bps()); | 191 packets, acknowledged_bitrate_estimator_->bitrate_bps()); |
191 const uint32_t kDummySsrc = 0; | 192 const uint32_t kDummySsrc = 0; |
192 if (result.updated) { | 193 if (result.updated) { |
193 bitrate_observer_.OnReceiveBitrateChanged({kDummySsrc}, | 194 bitrate_observer_.OnReceiveBitrateChanged({kDummySsrc}, |
194 result.target_bitrate_bps); | 195 result.target_bitrate_bps); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
(...skipping 14 matching lines...) Expand all Loading... |
212 | 213 |
213 bool overuse = false; | 214 bool overuse = false; |
214 bitrate_observer_.Reset(); | 215 bitrate_observer_.Reset(); |
215 clock_.AdvanceTimeMicroseconds(1000 * packets.back().arrival_time_ms - | 216 clock_.AdvanceTimeMicroseconds(1000 * packets.back().arrival_time_ms - |
216 clock_.TimeInMicroseconds()); | 217 clock_.TimeInMicroseconds()); |
217 for (auto& packet : packets) { | 218 for (auto& packet : packets) { |
218 RTC_CHECK_GE(packet.arrival_time_ms + arrival_time_offset_ms_, 0); | 219 RTC_CHECK_GE(packet.arrival_time_ms + arrival_time_offset_ms_, 0); |
219 packet.arrival_time_ms += arrival_time_offset_ms_; | 220 packet.arrival_time_ms += arrival_time_offset_ms_; |
220 } | 221 } |
221 | 222 |
222 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector(packets); | 223 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector(packets, false); |
223 DelayBasedBwe::Result result = | 224 DelayBasedBwe::Result result = |
224 bitrate_estimator_->IncomingPacketFeedbackVector( | 225 bitrate_estimator_->IncomingPacketFeedbackVector( |
225 packets, acknowledged_bitrate_estimator_->bitrate_bps()); | 226 packets, acknowledged_bitrate_estimator_->bitrate_bps()); |
226 const uint32_t kDummySsrc = 0; | 227 const uint32_t kDummySsrc = 0; |
227 if (result.updated) { | 228 if (result.updated) { |
228 bitrate_observer_.OnReceiveBitrateChanged({kDummySsrc}, | 229 bitrate_observer_.OnReceiveBitrateChanged({kDummySsrc}, |
229 result.target_bitrate_bps); | 230 result.target_bitrate_bps); |
230 if (!first_update_ && result.target_bitrate_bps < bitrate_bps) | 231 if (!first_update_ && result.target_bitrate_bps < bitrate_bps) |
231 overuse = true; | 232 overuse = true; |
232 first_update_ = false; | 233 first_update_ = false; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, | 505 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, |
505 sequence_number++, 1000); | 506 sequence_number++, 1000); |
506 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); | 507 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); |
507 send_time_ms += kFrameIntervalMs; | 508 send_time_ms += kFrameIntervalMs; |
508 } | 509 } |
509 uint32_t bitrate_after = 0; | 510 uint32_t bitrate_after = 0; |
510 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); | 511 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); |
511 EXPECT_LT(bitrate_after, bitrate_before); | 512 EXPECT_LT(bitrate_after, bitrate_before); |
512 } | 513 } |
513 } // namespace webrtc | 514 } // namespace webrtc |
OLD | NEW |