| 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 <memory> | 10 #include <memory> | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 30   return states; | 30   return states; | 
| 31 } | 31 } | 
| 32 | 32 | 
| 33 void UpdateRateControl(const AimdRateControlStates& states, | 33 void UpdateRateControl(const AimdRateControlStates& states, | 
| 34                        const BandwidthUsage& bandwidth_usage, | 34                        const BandwidthUsage& bandwidth_usage, | 
| 35                        int bitrate, | 35                        int bitrate, | 
| 36                        int64_t now_ms) { | 36                        int64_t now_ms) { | 
| 37   RateControlInput input(bandwidth_usage, rtc::Optional<uint32_t>(bitrate), | 37   RateControlInput input(bandwidth_usage, rtc::Optional<uint32_t>(bitrate), | 
| 38                          now_ms); | 38                          now_ms); | 
| 39   states.aimd_rate_control->Update(&input, now_ms); | 39   states.aimd_rate_control->Update(&input, now_ms); | 
| 40   states.aimd_rate_control->UpdateBandwidthEstimate(now_ms); |  | 
| 41 } | 40 } | 
| 42 | 41 | 
| 43 }  // namespace | 42 }  // namespace | 
| 44 | 43 | 
| 45 TEST(AimdRateControlTest, MinNearMaxIncreaseRateOnLowBandwith) { | 44 TEST(AimdRateControlTest, MinNearMaxIncreaseRateOnLowBandwith) { | 
| 46   auto states = CreateAimdRateControlStates(); | 45   auto states = CreateAimdRateControlStates(); | 
| 47   constexpr int kBitrate = 30000; | 46   constexpr int kBitrate = 30000; | 
| 48   states.aimd_rate_control->SetEstimate( | 47   states.aimd_rate_control->SetEstimate( | 
| 49       kBitrate, states.simulated_clock->TimeInMilliseconds()); | 48       kBitrate, states.simulated_clock->TimeInMilliseconds()); | 
| 50   EXPECT_EQ(4000, states.aimd_rate_control->GetNearMaxIncreaseRateBps()); | 49   EXPECT_EQ(4000, states.aimd_rate_control->GetNearMaxIncreaseRateBps()); | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 116   // what's being acked, but also shouldn't get to increase more. | 115   // what's being acked, but also shouldn't get to increase more. | 
| 117   uint32_t prev_estimate = states.aimd_rate_control->LatestEstimate(); | 116   uint32_t prev_estimate = states.aimd_rate_control->LatestEstimate(); | 
| 118   UpdateRateControl(states, kBwNormal, kAckedBitrate / 2, | 117   UpdateRateControl(states, kBwNormal, kAckedBitrate / 2, | 
| 119                     states.simulated_clock->TimeInMilliseconds()); | 118                     states.simulated_clock->TimeInMilliseconds()); | 
| 120   uint32_t new_estimate = states.aimd_rate_control->LatestEstimate(); | 119   uint32_t new_estimate = states.aimd_rate_control->LatestEstimate(); | 
| 121   EXPECT_NEAR(new_estimate, static_cast<uint32_t>(1.5 * kAckedBitrate + 10000), | 120   EXPECT_NEAR(new_estimate, static_cast<uint32_t>(1.5 * kAckedBitrate + 10000), | 
| 122               2000); | 121               2000); | 
| 123   EXPECT_EQ(new_estimate, prev_estimate); | 122   EXPECT_EQ(new_estimate, prev_estimate); | 
| 124 } | 123 } | 
| 125 }  // namespace webrtc | 124 }  // namespace webrtc | 
| OLD | NEW | 
|---|