| 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 <map> | 15 #include <map> |
| 16 #include <memory> | 16 #include <memory> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
| 20 #include "webrtc/rtc_base/optional.h" |
| 21 #include "webrtc/rtc_base/random.h" |
| 20 | 22 |
| 21 namespace webrtc { | 23 namespace webrtc { |
| 22 namespace testing { | 24 namespace testing { |
| 23 namespace bwe { | 25 namespace bwe { |
| 24 class MaxBandwidthFilter; | 26 class MaxBandwidthFilter; |
| 25 class MinRttFilter; | 27 class MinRttFilter; |
| 26 class CongestionWindow; | 28 class CongestionWindow; |
| 27 class BbrBweSender : public BweSender { | 29 class BbrBweSender : public BweSender { |
| 28 public: | 30 public: |
| 29 explicit BbrBweSender(Clock* clock); | 31 explicit BbrBweSender(Clock* clock); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 52 void GiveFeedback(const FeedbackPacket& feedback) override; | 54 void GiveFeedback(const FeedbackPacket& feedback) override; |
| 53 int64_t TimeUntilNextProcess() override; | 55 int64_t TimeUntilNextProcess() override; |
| 54 void Process() override; | 56 void Process() override; |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 void EnterStartup(); | 59 void EnterStartup(); |
| 58 bool UpdateBandwidthAndMinRtt(); | 60 bool UpdateBandwidthAndMinRtt(); |
| 59 void TryExitingStartup(); | 61 void TryExitingStartup(); |
| 60 void TryExitingDrain(int64_t now_ms); | 62 void TryExitingDrain(int64_t now_ms); |
| 61 void EnterProbeBw(int64_t now_ms); | 63 void EnterProbeBw(int64_t now_ms); |
| 62 void EnterProbeRtt(int64_t now_ms); | |
| 63 void TryUpdatingCyclePhase(int64_t now_ms); | 64 void TryUpdatingCyclePhase(int64_t now_ms); |
| 64 void TryEnteringProbeRtt(int64_t now_ms); | 65 void TryEnteringProbeRtt(int64_t now_ms); |
| 65 void TryExitingProbeRtt(int64_t now_ms); | 66 void TryExitingProbeRtt(int64_t now_ms, int64_t round); |
| 67 size_t TargetCongestionWindow(float gain); |
| 66 Clock* const clock_; | 68 Clock* const clock_; |
| 67 Mode mode_; | 69 Mode mode_; |
| 68 std::unique_ptr<MaxBandwidthFilter> max_bandwidth_filter_; | 70 std::unique_ptr<MaxBandwidthFilter> max_bandwidth_filter_; |
| 71 std::unique_ptr<MinRttFilter> min_rtt_filter_; |
| 72 std::unique_ptr<CongestionWindow> congestion_window_; |
| 73 std::unique_ptr<Random> rand_; |
| 69 uint64_t round_count_; | 74 uint64_t round_count_; |
| 70 uint64_t last_packet_sent_; | 75 uint64_t last_packet_sent_; |
| 71 uint64_t round_trip_end_; | 76 uint64_t round_trip_end_; |
| 72 float pacing_gain_; | 77 float pacing_gain_; |
| 73 float congestion_window_gain_; | 78 float congestion_window_gain_; |
| 74 | 79 |
| 75 // If optimal bandwidth has been discovered and reached, (for example after | 80 // If optimal bandwidth has been discovered and reached, (for example after |
| 76 // Startup mode) set this variable to true. | 81 // Startup mode) set this variable to true. |
| 77 bool full_bandwidth_reached_; | 82 bool full_bandwidth_reached_; |
| 83 |
| 84 // Entering time for PROBE_BW mode's cycle phase. |
| 85 int64_t cycle_start_time_ms_; |
| 86 |
| 87 // Index number of the currently used gain value in PROBE_BW mode, from 0 to |
| 88 // kGainCycleLength - 1. |
| 89 int64_t cycle_index_; |
| 90 |
| 91 // Data inflight prior to the moment when last feedback was received. |
| 92 size_t prior_in_flight_; |
| 93 |
| 94 // Time we entered PROBE_RTT mode. |
| 95 int64_t probe_rtt_start_time_ms_; |
| 96 |
| 97 // First moment of time when data inflight decreased below |
| 98 // kMinimumCongestionWindow in PROBE_RTT mode. |
| 99 rtc::Optional<int64_t> minimum_congestion_window_start_time_ms_; |
| 100 |
| 101 // First round when data inflight decreased below kMinimumCongestionWindow in |
| 102 // PROBE_RTT mode. |
| 103 int64_t minimum_congestion_window_start_round_; |
| 78 }; | 104 }; |
| 79 | 105 |
| 80 class BbrBweReceiver : public BweReceiver { | 106 class BbrBweReceiver : public BweReceiver { |
| 81 public: | 107 public: |
| 82 explicit BbrBweReceiver(int flow_id); | 108 explicit BbrBweReceiver(int flow_id); |
| 83 virtual ~BbrBweReceiver(); | 109 virtual ~BbrBweReceiver(); |
| 84 void ReceivePacket(int64_t arrival_time_ms, | 110 void ReceivePacket(int64_t arrival_time_ms, |
| 85 const MediaPacket& media_packet) override; | 111 const MediaPacket& media_packet) override; |
| 86 FeedbackPacket* GetFeedback(int64_t now_ms) override; | 112 FeedbackPacket* GetFeedback(int64_t now_ms) override; |
| 87 | 113 |
| 88 private: | 114 private: |
| 89 SimulatedClock clock_; | 115 SimulatedClock clock_; |
| 90 }; | 116 }; |
| 91 } // namespace bwe | 117 } // namespace bwe |
| 92 } // namespace testing | 118 } // namespace testing |
| 93 } // namespace webrtc | 119 } // namespace webrtc |
| 94 | 120 |
| 95 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ | 121 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
| OLD | NEW |