OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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/modules/remote_bitrate_estimator/transport_feedback_adapter.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" |
24 | 24 |
25 namespace rtc { | 25 namespace rtc { |
26 struct SentPacket; | 26 struct SentPacket; |
27 } | 27 } |
28 | 28 |
29 namespace webrtc { | 29 namespace webrtc { |
30 | 30 |
31 class BitrateController; | 31 class BitrateController; |
32 class Clock; | 32 class Clock; |
| 33 class ProbeController; |
33 class ProcessThread; | 34 class ProcessThread; |
34 class RateLimiter; | 35 class RateLimiter; |
35 class RemoteBitrateEstimator; | 36 class RemoteBitrateEstimator; |
36 class RemoteBitrateObserver; | 37 class RemoteBitrateObserver; |
37 class RtcEventLog; | 38 class RtcEventLog; |
38 class TransportFeedbackObserver; | 39 class TransportFeedbackObserver; |
39 | 40 |
40 class CongestionController : public CallStatsObserver, public Module { | 41 class CongestionController : public CallStatsObserver, public Module { |
41 public: | 42 public: |
42 // Observer class for bitrate changes announced due to change in bandwidth | 43 // Observer class for bitrate changes announced due to change in bandwidth |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // a lower bitrate estimate. | 92 // a lower bitrate estimate. |
92 // |max_padding_bitrate_bps| is the max bitrate the send streams request for | 93 // |max_padding_bitrate_bps| is the max bitrate the send streams request for |
93 // padding. This can be higher than the current network estimate and tells | 94 // padding. This can be higher than the current network estimate and tells |
94 // the PacedSender how much it should max pad unless there is real packets to | 95 // the PacedSender how much it should max pad unless there is real packets to |
95 // send. | 96 // send. |
96 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, | 97 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, |
97 int max_padding_bitrate_bps); | 98 int max_padding_bitrate_bps); |
98 | 99 |
99 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); | 100 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); |
100 | 101 |
| 102 // Called by delay based estimator to report estimated bandwidth. |
| 103 void OnDelayBasedBweChanged(int bitrate_bps); |
| 104 // Called by delay based estimator to report measured probing bitrate. |
| 105 void OnProbeBitrate(int bitrate_bps); |
| 106 |
101 // Implements CallStatsObserver. | 107 // Implements CallStatsObserver. |
102 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 108 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
103 | 109 |
104 // Implements Module. | 110 // Implements Module. |
105 int64_t TimeUntilNextProcess() override; | 111 int64_t TimeUntilNextProcess() override; |
106 void Process() override; | 112 void Process() override; |
107 | 113 |
108 private: | 114 private: |
109 void Init(); | 115 void Init(); |
110 void MaybeTriggerOnNetworkChanged(); | 116 void MaybeTriggerOnNetworkChanged(); |
111 | 117 |
112 bool IsSendQueueFull() const; | 118 bool IsSendQueueFull() const; |
113 bool IsNetworkDown() const; | 119 bool IsNetworkDown() const; |
114 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, | 120 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, |
115 uint8_t fraction_loss, | 121 uint8_t fraction_loss, |
116 int64_t rtt); | 122 int64_t rtt); |
117 Clock* const clock_; | 123 Clock* const clock_; |
118 Observer* const observer_; | 124 Observer* const observer_; |
119 const std::unique_ptr<PacketRouter> packet_router_; | 125 const std::unique_ptr<PacketRouter> packet_router_; |
120 const std::unique_ptr<PacedSender> pacer_; | 126 const std::unique_ptr<PacedSender> pacer_; |
121 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 127 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
122 const std::unique_ptr<BitrateController> bitrate_controller_; | 128 const std::unique_ptr<BitrateController> bitrate_controller_; |
| 129 const std::unique_ptr<ProbeController> probe_controller_; |
123 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 130 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
124 RemoteEstimatorProxy remote_estimator_proxy_; | 131 RemoteEstimatorProxy remote_estimator_proxy_; |
125 TransportFeedbackAdapter transport_feedback_adapter_; | 132 TransportFeedbackAdapter transport_feedback_adapter_; |
126 int min_bitrate_bps_; | 133 int min_bitrate_bps_; |
127 int max_bitrate_bps_; | 134 int max_bitrate_bps_; |
128 bool initial_probing_triggered_; | |
129 rtc::CriticalSection critsect_; | 135 rtc::CriticalSection critsect_; |
130 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); | 136 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); |
131 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); | 137 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); |
132 int64_t last_reported_rtt_ GUARDED_BY(critsect_); | 138 int64_t last_reported_rtt_ GUARDED_BY(critsect_); |
133 NetworkState network_state_ GUARDED_BY(critsect_); | 139 NetworkState network_state_ GUARDED_BY(critsect_); |
134 | 140 |
135 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); | 141 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); |
136 }; | 142 }; |
137 | 143 |
138 } // namespace webrtc | 144 } // namespace webrtc |
139 | 145 |
140 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ | 146 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ |
OLD | NEW |