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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class Observer { | 51 class Observer { |
52 public: | 52 public: |
53 virtual void OnNetworkChanged(uint32_t bitrate_bps, | 53 virtual void OnNetworkChanged(uint32_t bitrate_bps, |
54 uint8_t fraction_loss, // 0 - 255. | 54 uint8_t fraction_loss, // 0 - 255. |
55 int64_t rtt_ms, | 55 int64_t rtt_ms, |
56 int64_t probing_interval_ms) = 0; | 56 int64_t probing_interval_ms) = 0; |
57 | 57 |
58 protected: | 58 protected: |
59 virtual ~Observer() {} | 59 virtual ~Observer() {} |
60 }; | 60 }; |
| 61 // TODO(holmer): Delete after fixing upstream projects. |
| 62 RTC_DEPRECATED SendSideCongestionController(const Clock* clock, |
| 63 Observer* observer, |
| 64 RtcEventLog* event_log, |
| 65 PacketRouter* packet_router); |
61 // TODO(nisse): Consider deleting the |observer| argument to constructors | 66 // TODO(nisse): Consider deleting the |observer| argument to constructors |
62 // once CongestionController is deleted. | 67 // once CongestionController is deleted. |
63 SendSideCongestionController(const Clock* clock, | 68 SendSideCongestionController(const Clock* clock, |
64 Observer* observer, | 69 Observer* observer, |
65 RtcEventLog* event_log, | 70 RtcEventLog* event_log, |
66 PacketRouter* packet_router); | 71 PacedSender* pacer); |
67 SendSideCongestionController(const Clock* clock, | |
68 Observer* observer, | |
69 RtcEventLog* event_log, | |
70 std::unique_ptr<PacedSender> pacer); | |
71 ~SendSideCongestionController() override; | 72 ~SendSideCongestionController() override; |
72 | 73 |
73 void RegisterPacketFeedbackObserver(PacketFeedbackObserver* observer); | 74 void RegisterPacketFeedbackObserver(PacketFeedbackObserver* observer); |
74 void DeRegisterPacketFeedbackObserver(PacketFeedbackObserver* observer); | 75 void DeRegisterPacketFeedbackObserver(PacketFeedbackObserver* observer); |
75 | 76 |
76 // Currently, there can be at most one observer. | 77 // Currently, there can be at most one observer. |
77 void RegisterNetworkObserver(Observer* observer); | 78 void RegisterNetworkObserver(Observer* observer); |
78 void DeRegisterNetworkObserver(Observer* observer); | 79 void DeRegisterNetworkObserver(Observer* observer); |
79 | 80 |
80 virtual void SetBweBitrates(int min_bitrate_bps, | 81 virtual void SetBweBitrates(int min_bitrate_bps, |
81 int start_bitrate_bps, | 82 int start_bitrate_bps, |
82 int max_bitrate_bps); | 83 int max_bitrate_bps); |
83 // Resets the BWE state. Note the first argument is the bitrate_bps. | 84 // Resets the BWE state. Note the first argument is the bitrate_bps. |
84 virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route, | 85 virtual void OnNetworkRouteChanged(const rtc::NetworkRoute& network_route, |
85 int bitrate_bps, | 86 int bitrate_bps, |
86 int min_bitrate_bps, | 87 int min_bitrate_bps, |
87 int max_bitrate_bps); | 88 int max_bitrate_bps); |
88 virtual void SignalNetworkState(NetworkState state); | 89 virtual void SignalNetworkState(NetworkState state); |
89 virtual void SetTransportOverhead(size_t transport_overhead_bytes_per_packet); | 90 virtual void SetTransportOverhead(size_t transport_overhead_bytes_per_packet); |
90 | 91 |
91 virtual BitrateController* GetBitrateController() const; | 92 virtual BitrateController* GetBitrateController() const; |
92 virtual int64_t GetPacerQueuingDelayMs() const; | 93 virtual int64_t GetPacerQueuingDelayMs() const; |
93 virtual int64_t GetFirstPacketTimeMs() const; | 94 virtual int64_t GetFirstPacketTimeMs() const; |
94 // TODO(nisse): Delete this accessor function. The pacer should be | 95 |
95 // internal to the congestion controller. | |
96 virtual PacedSender* pacer(); | |
97 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); | 96 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); |
98 | 97 |
99 RateLimiter* GetRetransmissionRateLimiter(); | 98 RateLimiter* GetRetransmissionRateLimiter(); |
100 void EnablePeriodicAlrProbing(bool enable); | 99 void EnablePeriodicAlrProbing(bool enable); |
101 | 100 |
102 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec | |
103 // settings. | |
104 // |min_send_bitrate_bps| is the total minimum send bitrate required by all | |
105 // sending streams. This is the minimum bitrate the PacedSender will use. | |
106 // Note that SendSideCongestionController::OnNetworkChanged can still be | |
107 // called with a lower bitrate estimate. |max_padding_bitrate_bps| is the max | |
108 // bitrate the send streams request for padding. This can be higher than the | |
109 // current network estimate and tells the PacedSender how much it should max | |
110 // pad unless there is real packets to send. | |
111 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, | |
112 int max_padding_bitrate_bps); | |
113 | |
114 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); | 101 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); |
115 | 102 |
116 // Implements CallStatsObserver. | 103 // Implements CallStatsObserver. |
117 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 104 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
118 | 105 |
119 // Implements Module. | 106 // Implements Module. |
120 int64_t TimeUntilNextProcess() override; | 107 int64_t TimeUntilNextProcess() override; |
121 void Process() override; | 108 void Process() override; |
122 | 109 |
123 // Implements TransportFeedbackObserver. | 110 // Implements TransportFeedbackObserver. |
(...skipping 10 matching lines...) Expand all Loading... |
134 bool IsSendQueueFull() const; | 121 bool IsSendQueueFull() const; |
135 bool IsNetworkDown() const; | 122 bool IsNetworkDown() const; |
136 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, | 123 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, |
137 uint8_t fraction_loss, | 124 uint8_t fraction_loss, |
138 int64_t rtt); | 125 int64_t rtt); |
139 void LimitOutstandingBytes(size_t num_outstanding_bytes); | 126 void LimitOutstandingBytes(size_t num_outstanding_bytes); |
140 const Clock* const clock_; | 127 const Clock* const clock_; |
141 rtc::CriticalSection observer_lock_; | 128 rtc::CriticalSection observer_lock_; |
142 Observer* observer_ GUARDED_BY(observer_lock_); | 129 Observer* observer_ GUARDED_BY(observer_lock_); |
143 RtcEventLog* const event_log_; | 130 RtcEventLog* const event_log_; |
144 const std::unique_ptr<PacedSender> pacer_; | 131 std::unique_ptr<PacedSender> owned_pacer_; |
| 132 PacedSender* pacer_; |
145 const std::unique_ptr<BitrateController> bitrate_controller_; | 133 const std::unique_ptr<BitrateController> bitrate_controller_; |
146 std::unique_ptr<AcknowledgedBitrateEstimator> acknowledged_bitrate_estimator_; | 134 std::unique_ptr<AcknowledgedBitrateEstimator> acknowledged_bitrate_estimator_; |
147 const std::unique_ptr<ProbeController> probe_controller_; | 135 const std::unique_ptr<ProbeController> probe_controller_; |
148 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 136 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
149 TransportFeedbackAdapter transport_feedback_adapter_; | 137 TransportFeedbackAdapter transport_feedback_adapter_; |
150 rtc::CriticalSection network_state_lock_; | 138 rtc::CriticalSection network_state_lock_; |
151 uint32_t last_reported_bitrate_bps_ GUARDED_BY(network_state_lock_); | 139 uint32_t last_reported_bitrate_bps_ GUARDED_BY(network_state_lock_); |
152 uint8_t last_reported_fraction_loss_ GUARDED_BY(network_state_lock_); | 140 uint8_t last_reported_fraction_loss_ GUARDED_BY(network_state_lock_); |
153 int64_t last_reported_rtt_ GUARDED_BY(network_state_lock_); | 141 int64_t last_reported_rtt_ GUARDED_BY(network_state_lock_); |
154 NetworkState network_state_ GUARDED_BY(network_state_lock_); | 142 NetworkState network_state_ GUARDED_BY(network_state_lock_); |
(...skipping 10 matching lines...) Expand all Loading... |
165 bool was_in_alr_; | 153 bool was_in_alr_; |
166 | 154 |
167 rtc::RaceChecker worker_race_; | 155 rtc::RaceChecker worker_race_; |
168 | 156 |
169 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendSideCongestionController); | 157 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendSideCongestionController); |
170 }; | 158 }; |
171 | 159 |
172 } // namespace webrtc | 160 } // namespace webrtc |
173 | 161 |
174 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_SEND_SIDE_CONGESTION_CON
TROLLER_H_ | 162 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_SEND_SIDE_CONGESTION_CON
TROLLER_H_ |
OLD | NEW |