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, |
| 42 public Module, |
| 43 public RemoteBitrateObserver { |
41 public: | 44 public: |
42 // Observer class for bitrate changes announced due to change in bandwidth | 45 // Observer class for bitrate changes announced due to change in bandwidth |
43 // estimate or due to that the send pacer is full. Fraction loss and rtt is | 46 // estimate or due to that the send pacer is full. Fraction loss and rtt is |
44 // also part of this callback to allow the observer to optimize its settings | 47 // also part of this callback to allow the observer to optimize its settings |
45 // for different types of network environments. The bitrate does not include | 48 // for different types of network environments. The bitrate does not include |
46 // packet headers and is measured in bits per second. | 49 // packet headers and is measured in bits per second. |
47 class Observer { | 50 class Observer { |
48 public: | 51 public: |
49 virtual void OnNetworkChanged(uint32_t bitrate_bps, | 52 virtual void OnNetworkChanged(uint32_t bitrate_bps, |
50 uint8_t fraction_loss, // 0 - 255. | 53 uint8_t fraction_loss, // 0 - 255. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // a lower bitrate estimate. | 94 // a lower bitrate estimate. |
92 // |max_padding_bitrate_bps| is the max bitrate the send streams request for | 95 // |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 | 96 // 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 | 97 // the PacedSender how much it should max pad unless there is real packets to |
95 // send. | 98 // send. |
96 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, | 99 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, |
97 int max_padding_bitrate_bps); | 100 int max_padding_bitrate_bps); |
98 | 101 |
99 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); | 102 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); |
100 | 103 |
| 104 // Implements RemoteBitrateObserver. |
| 105 // Called by delay based estimator to report estimated bandwidth. |
| 106 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, |
| 107 uint32_t bitrate_bps) override; |
| 108 // Called by delay based estimator to report measured probing bitrate. |
| 109 void OnProbeBitrate(uint32_t bitrate_bps) override; |
| 110 |
101 // Implements CallStatsObserver. | 111 // Implements CallStatsObserver. |
102 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 112 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
103 | 113 |
104 // Implements Module. | 114 // Implements Module. |
105 int64_t TimeUntilNextProcess() override; | 115 int64_t TimeUntilNextProcess() override; |
106 void Process() override; | 116 void Process() override; |
107 | 117 |
108 private: | 118 private: |
109 void Init(); | 119 void Init(); |
110 void MaybeTriggerOnNetworkChanged(); | 120 void MaybeTriggerOnNetworkChanged(); |
111 | 121 |
112 bool IsSendQueueFull() const; | 122 bool IsSendQueueFull() const; |
113 bool IsNetworkDown() const; | 123 bool IsNetworkDown() const; |
114 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, | 124 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, |
115 uint8_t fraction_loss, | 125 uint8_t fraction_loss, |
116 int64_t rtt); | 126 int64_t rtt); |
117 Clock* const clock_; | 127 Clock* const clock_; |
118 Observer* const observer_; | 128 Observer* const observer_; |
119 const std::unique_ptr<PacketRouter> packet_router_; | 129 const std::unique_ptr<PacketRouter> packet_router_; |
120 const std::unique_ptr<PacedSender> pacer_; | 130 const std::unique_ptr<PacedSender> pacer_; |
121 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 131 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
122 const std::unique_ptr<BitrateController> bitrate_controller_; | 132 const std::unique_ptr<BitrateController> bitrate_controller_; |
| 133 const std::unique_ptr<ProbeController> probe_controller_; |
123 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 134 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
124 RemoteEstimatorProxy remote_estimator_proxy_; | 135 RemoteEstimatorProxy remote_estimator_proxy_; |
125 TransportFeedbackAdapter transport_feedback_adapter_; | 136 TransportFeedbackAdapter transport_feedback_adapter_; |
126 int min_bitrate_bps_; | 137 int min_bitrate_bps_; |
127 int max_bitrate_bps_; | 138 int max_bitrate_bps_; |
128 bool initial_probing_triggered_; | |
129 rtc::CriticalSection critsect_; | 139 rtc::CriticalSection critsect_; |
130 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); | 140 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); |
131 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); | 141 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); |
132 int64_t last_reported_rtt_ GUARDED_BY(critsect_); | 142 int64_t last_reported_rtt_ GUARDED_BY(critsect_); |
133 NetworkState network_state_ GUARDED_BY(critsect_); | 143 NetworkState network_state_ GUARDED_BY(critsect_); |
134 | 144 |
135 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); | 145 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); |
136 }; | 146 }; |
137 | 147 |
138 } // namespace webrtc | 148 } // namespace webrtc |
139 | 149 |
140 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ | 150 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ |
OLD | NEW |