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 */ |
11 | 11 |
12 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ | 12 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
13 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ | 13 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
14 | 14 |
15 #include <climits> | |
16 #include <map> | 15 #include <map> |
17 #include <memory> | 16 #include <memory> |
18 #include <utility> | |
19 #include <vector> | 17 #include <vector> |
20 | 18 |
21 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" | |
22 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" | |
23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
24 | 20 |
25 namespace webrtc { | 21 namespace webrtc { |
26 namespace testing { | 22 namespace testing { |
27 namespace bwe { | 23 namespace bwe { |
28 class MaxBandwidthFilter; | 24 class MaxBandwidthFilter; |
29 class MinRttFilter; | 25 class MinRttFilter; |
30 class CongestionWindow; | 26 class CongestionWindow; |
31 class BbrBweSender : public BweSender { | 27 class BbrBweSender : public BweSender { |
32 public: | 28 public: |
33 BbrBweSender(); | 29 explicit BbrBweSender(Clock* clock); |
34 virtual ~BbrBweSender(); | 30 virtual ~BbrBweSender(); |
35 enum Mode { | 31 enum Mode { |
36 // Startup phase. | 32 // Startup phase. |
37 STARTUP, | 33 STARTUP, |
38 // Queue draining phase, which where created during startup. | 34 // Queue draining phase, which where created during startup. |
39 DRAIN, | 35 DRAIN, |
40 // Cruising, probing new bandwidth. | 36 // Cruising, probing new bandwidth. |
41 PROBE_BW, | 37 PROBE_BW, |
42 // Temporarily limiting congestion window size in order to measure | 38 // Temporarily limiting congestion window size in order to measure |
43 // minimum RTT. | 39 // minimum RTT. |
(...skipping 13 matching lines...) Expand all Loading... |
57 int64_t TimeUntilNextProcess() override; | 53 int64_t TimeUntilNextProcess() override; |
58 void Process() override; | 54 void Process() override; |
59 | 55 |
60 private: | 56 private: |
61 void EnterStartup(); | 57 void EnterStartup(); |
62 bool UpdateBandwidthAndMinRtt(); | 58 bool UpdateBandwidthAndMinRtt(); |
63 void TryExitingStartup(); | 59 void TryExitingStartup(); |
64 void TryExitingDrain(int64_t now); | 60 void TryExitingDrain(int64_t now); |
65 void EnterProbeBw(int64_t now); | 61 void EnterProbeBw(int64_t now); |
66 void EnterProbeRtt(int64_t now); | 62 void EnterProbeRtt(int64_t now); |
| 63 void TryUpdatingCyclePhase(int64_t now); |
| 64 void TryEnteringProbeRtt(int64_t now); |
67 void TryExitingProbeRtt(int64_t now); | 65 void TryExitingProbeRtt(int64_t now); |
68 void TryUpdatingCyclePhase(int64_t now); | 66 Clock* const clock_; |
| 67 Mode mode_; |
| 68 std::unique_ptr<MaxBandwidthFilter> max_bandwidth_filter_; |
| 69 uint64_t round_count_; |
| 70 uint64_t last_packet_sent_; |
| 71 uint64_t round_trip_end_; |
| 72 float pacing_gain_; |
| 73 float congestion_window_gain_; |
| 74 |
| 75 // If optimal bandwidth has been discovered and reached, (for example after |
| 76 // Startup mode) set this variable to true. |
| 77 bool full_bandwidth_reached_; |
69 }; | 78 }; |
70 | 79 |
71 class BbrBweReceiver : public BweReceiver { | 80 class BbrBweReceiver : public BweReceiver { |
72 public: | 81 public: |
73 explicit BbrBweReceiver(int flow_id); | 82 explicit BbrBweReceiver(int flow_id); |
74 virtual ~BbrBweReceiver(); | 83 virtual ~BbrBweReceiver(); |
75 void ReceivePacket(int64_t arrival_time_ms, | 84 void ReceivePacket(int64_t arrival_time_ms, |
76 const MediaPacket& media_packet) override; | 85 const MediaPacket& media_packet) override; |
77 FeedbackPacket* GetFeedback(int64_t now_ms) override; | 86 FeedbackPacket* GetFeedback(int64_t now_ms) override; |
78 | 87 |
79 private: | 88 private: |
80 SimulatedClock clock_; | 89 SimulatedClock clock_; |
81 std::vector<std::pair<uint64_t, int64_t>> packet_feedbacks_; | |
82 }; | 90 }; |
83 } // namespace bwe | 91 } // namespace bwe |
84 } // namespace testing | 92 } // namespace testing |
85 } // namespace webrtc | 93 } // namespace webrtc |
86 | 94 |
87 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ | 95 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
OLD | NEW |