OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 12 matching lines...) Expand all Loading... |
23 #include "webrtc/rtc_base/random.h" | 23 #include "webrtc/rtc_base/random.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 namespace testing { | 26 namespace testing { |
27 namespace bwe { | 27 namespace bwe { |
28 class MaxBandwidthFilter; | 28 class MaxBandwidthFilter; |
29 class MinRttFilter; | 29 class MinRttFilter; |
30 class CongestionWindow; | 30 class CongestionWindow; |
31 class BbrBweSender : public BweSender { | 31 class BbrBweSender : public BweSender { |
32 public: | 32 public: |
33 explicit BbrBweSender(Clock* clock); | 33 explicit BbrBweSender(BitrateObserver* observer, Clock* clock); |
34 virtual ~BbrBweSender(); | 34 virtual ~BbrBweSender(); |
35 enum Mode { | 35 enum Mode { |
36 // Startup phase. | 36 // Startup phase. |
37 STARTUP, | 37 STARTUP, |
38 // Queue draining phase, which where created during startup. | 38 // Queue draining phase, which where created during startup. |
39 DRAIN, | 39 DRAIN, |
40 // Cruising, probing new bandwidth. | 40 // Cruising, probing new bandwidth. |
41 PROBE_BW, | 41 PROBE_BW, |
42 // Temporarily limiting congestion window size in order to measure | 42 // Temporarily limiting congestion window size in order to measure |
43 // minimum RTT. | 43 // minimum RTT. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 uint64_t round; | 106 uint64_t round; |
107 }; | 107 }; |
108 void OnPacketsSent(const Packets& packets) override; | 108 void OnPacketsSent(const Packets& packets) override; |
109 int GetFeedbackIntervalMs() const override; | 109 int GetFeedbackIntervalMs() const override; |
110 void GiveFeedback(const FeedbackPacket& feedback) override; | 110 void GiveFeedback(const FeedbackPacket& feedback) override; |
111 int64_t TimeUntilNextProcess() override; | 111 int64_t TimeUntilNextProcess() override; |
112 void Process() override; | 112 void Process() override; |
113 | 113 |
114 private: | 114 private: |
115 void EnterStartup(); | 115 void EnterStartup(); |
116 bool UpdateBandwidthAndMinRtt(int64_t now_ms, | 116 void UpdateBandwidthAndMinRtt(int64_t now_ms, |
117 const std::vector<uint64_t>& feedback_vector, | 117 const std::vector<uint16_t>& feedback_vector, |
118 int64_t bytes_acked); | 118 int64_t bytes_acked); |
119 void TryExitingStartup(); | 119 void TryExitingStartup(); |
120 void TryExitingDrain(int64_t now_ms); | 120 void TryExitingDrain(int64_t now_ms); |
121 void EnterProbeBw(int64_t now_ms); | 121 void EnterProbeBw(int64_t now_ms); |
122 void TryUpdatingCyclePhase(int64_t now_ms); | 122 void TryUpdatingCyclePhase(int64_t now_ms); |
123 void TryEnteringProbeRtt(int64_t now_ms); | 123 void TryEnteringProbeRtt(int64_t now_ms); |
124 void TryExitingProbeRtt(int64_t now_ms, int64_t round); | 124 void TryExitingProbeRtt(int64_t now_ms, int64_t round); |
125 void TryEnteringRecovery(bool new_round_started); | 125 void TryEnteringRecovery(bool new_round_started); |
126 void TryExitingRecovery(bool new_round_started); | 126 void TryExitingRecovery(bool new_round_started); |
127 size_t TargetCongestionWindow(float gain); | 127 size_t TargetCongestionWindow(float gain); |
(...skipping 10 matching lines...) Expand all Loading... |
138 // phase. Motivation of having a seperate bucket for high gain phase is to | 138 // phase. Motivation of having a seperate bucket for high gain phase is to |
139 // achieve quicker ramp up. Slight overestimations may happen due to window | 139 // achieve quicker ramp up. Slight overestimations may happen due to window |
140 // not being as large as usual. | 140 // not being as large as usual. |
141 void AddSampleForHighGain(); | 141 void AddSampleForHighGain(); |
142 | 142 |
143 // Declares lost packets as acked. Implements simple logic by looking at the | 143 // Declares lost packets as acked. Implements simple logic by looking at the |
144 // gap between sequence numbers. If there is a gap between sequence numbers we | 144 // gap between sequence numbers. If there is a gap between sequence numbers we |
145 // declare those packets as lost immediately. | 145 // declare those packets as lost immediately. |
146 void HandleLoss(uint64_t last_acked_packet, uint64_t recently_acked_packet); | 146 void HandleLoss(uint64_t last_acked_packet, uint64_t recently_acked_packet); |
147 void AddToPastRtts(int64_t rtt_sample_ms); | 147 void AddToPastRtts(int64_t rtt_sample_ms); |
| 148 BitrateObserver* observer_; |
148 Clock* const clock_; | 149 Clock* const clock_; |
149 Mode mode_; | 150 Mode mode_; |
150 std::unique_ptr<MaxBandwidthFilter> max_bandwidth_filter_; | 151 std::unique_ptr<MaxBandwidthFilter> max_bandwidth_filter_; |
151 std::unique_ptr<MinRttFilter> min_rtt_filter_; | 152 std::unique_ptr<MinRttFilter> min_rtt_filter_; |
152 std::unique_ptr<CongestionWindow> congestion_window_; | 153 std::unique_ptr<CongestionWindow> congestion_window_; |
153 std::unique_ptr<Random> rand_; | 154 std::unique_ptr<Random> rand_; |
154 uint64_t round_count_; | 155 uint64_t round_count_; |
155 uint64_t round_trip_end_; | 156 uint64_t round_trip_end_; |
156 float pacing_gain_; | 157 float pacing_gain_; |
157 float congestion_window_gain_; | 158 float congestion_window_gain_; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 std::list<AverageRtt> past_rtts_; | 223 std::list<AverageRtt> past_rtts_; |
223 }; | 224 }; |
224 | 225 |
225 class BbrBweReceiver : public BweReceiver { | 226 class BbrBweReceiver : public BweReceiver { |
226 public: | 227 public: |
227 explicit BbrBweReceiver(int flow_id); | 228 explicit BbrBweReceiver(int flow_id); |
228 virtual ~BbrBweReceiver(); | 229 virtual ~BbrBweReceiver(); |
229 void ReceivePacket(int64_t arrival_time_ms, | 230 void ReceivePacket(int64_t arrival_time_ms, |
230 const MediaPacket& media_packet) override; | 231 const MediaPacket& media_packet) override; |
231 FeedbackPacket* GetFeedback(int64_t now_ms) override; | 232 FeedbackPacket* GetFeedback(int64_t now_ms) override; |
232 | |
233 private: | 233 private: |
234 SimulatedClock clock_; | 234 SimulatedClock clock_; |
235 std::vector<uint64_t> packet_feedbacks_; | 235 std::vector<uint16_t> packet_feedbacks_; |
| 236 int64_t last_feedback_ms_; |
236 }; | 237 }; |
237 } // namespace bwe | 238 } // namespace bwe |
238 } // namespace testing | 239 } // namespace testing |
239 } // namespace webrtc | 240 } // namespace webrtc |
240 | 241 |
241 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ | 242 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
OLD | NEW |