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
" |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <limits> | 13 #include <limits> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 17 #include "webrtc/base/ptr_util.h" |
17 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" | 18 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 | 21 |
21 constexpr size_t kMtu = 1200; | 22 constexpr size_t kMtu = 1200; |
22 constexpr uint32_t kAcceptedBitrateErrorBps = 50000; | 23 constexpr uint32_t kAcceptedBitrateErrorBps = 50000; |
23 | 24 |
24 // Number of packets needed before we have a valid estimate. | 25 // Number of packets needed before we have a valid estimate. |
25 constexpr int kNumInitialPackets = 2; | 26 constexpr int kNumInitialPackets = 2; |
26 | 27 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 packet.arrival_time_ms = prev_arrival_time_us_ / 1000; | 143 packet.arrival_time_ms = prev_arrival_time_us_ / 1000; |
143 ++i; | 144 ++i; |
144 } | 145 } |
145 it = std::min_element(streams_.begin(), streams_.end(), RtpStream::Compare); | 146 it = std::min_element(streams_.begin(), streams_.end(), RtpStream::Compare); |
146 return std::max((*it)->next_rtp_time(), time_now_us); | 147 return std::max((*it)->next_rtp_time(), time_now_us); |
147 } | 148 } |
148 } // namespace test | 149 } // namespace test |
149 | 150 |
150 DelayBasedBweTest::DelayBasedBweTest() | 151 DelayBasedBweTest::DelayBasedBweTest() |
151 : clock_(100000000), | 152 : clock_(100000000), |
152 bitrate_estimator_(new DelayBasedBwe(nullptr, &clock_)), | 153 incoming_bitrate_estimator_(rtc::MakeUnique<IncomingBitrateEstimator>()), |
| 154 bitrate_estimator_(new DelayBasedBwe(nullptr, |
| 155 incoming_bitrate_estimator_.get(), |
| 156 &clock_)), |
153 stream_generator_(new test::StreamGenerator(1e6, // Capacity. | 157 stream_generator_(new test::StreamGenerator(1e6, // Capacity. |
154 clock_.TimeInMicroseconds())), | 158 clock_.TimeInMicroseconds())), |
155 arrival_time_offset_ms_(0), | 159 arrival_time_offset_ms_(0), |
156 first_update_(true) {} | 160 first_update_(true) {} |
157 | 161 |
158 DelayBasedBweTest::~DelayBasedBweTest() {} | 162 DelayBasedBweTest::~DelayBasedBweTest() {} |
159 | 163 |
160 void DelayBasedBweTest::AddDefaultStream() { | 164 void DelayBasedBweTest::AddDefaultStream() { |
161 stream_generator_->AddStream(new test::RtpStream(30, 3e5)); | 165 stream_generator_->AddStream(new test::RtpStream(30, 3e5)); |
162 } | 166 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, | 500 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, |
497 sequence_number++, 1000); | 501 sequence_number++, 1000); |
498 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); | 502 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); |
499 send_time_ms += kFrameIntervalMs; | 503 send_time_ms += kFrameIntervalMs; |
500 } | 504 } |
501 uint32_t bitrate_after = 0; | 505 uint32_t bitrate_after = 0; |
502 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); | 506 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); |
503 EXPECT_LT(bitrate_after, bitrate_before); | 507 EXPECT_LT(bitrate_after, bitrate_before); |
504 } | 508 } |
505 } // namespace webrtc | 509 } // namespace webrtc |
OLD | NEW |