Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Side by Side Diff: webrtc/modules/congestion_controller/include/congestion_controller.h

Issue 2743553003: Revert of Move delay_based_bwe_ into CongestionController (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/constructormagic.h" 17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/criticalsection.h" 18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/base/thread_checker.h"
20 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
21 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
22 #include "webrtc/modules/congestion_controller/transport_feedback_adapter.h" 20 #include "webrtc/modules/congestion_controller/transport_feedback_adapter.h"
23 #include "webrtc/modules/include/module.h" 21 #include "webrtc/modules/include/module.h"
24 #include "webrtc/modules/include/module_common_types.h" 22 #include "webrtc/modules/include/module_common_types.h"
23 #include "webrtc/modules/pacing/packet_router.h"
25 #include "webrtc/modules/pacing/paced_sender.h" 24 #include "webrtc/modules/pacing/paced_sender.h"
26 #include "webrtc/modules/pacing/packet_router.h"
27 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" 25 #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h"
28 26
29 namespace rtc { 27 namespace rtc {
30 struct SentPacket; 28 struct SentPacket;
31 } 29 }
32 30
33 namespace webrtc { 31 namespace webrtc {
34 32
35 class BitrateController; 33 class BitrateController;
36 class Clock; 34 class Clock;
37 class ProbeController; 35 class ProbeController;
38 class RateLimiter; 36 class RateLimiter;
39 class RemoteBitrateEstimator; 37 class RemoteBitrateEstimator;
40 class RemoteBitrateObserver; 38 class RemoteBitrateObserver;
41 class RtcEventLog; 39 class RtcEventLog;
40 class TransportFeedbackObserver;
42 41
43 class CongestionController : public CallStatsObserver, 42 class CongestionController : public CallStatsObserver, public Module {
44 public Module,
45 public TransportFeedbackObserver {
46 public: 43 public:
47 // Observer class for bitrate changes announced due to change in bandwidth 44 // Observer class for bitrate changes announced due to change in bandwidth
48 // estimate or due to that the send pacer is full. Fraction loss and rtt is 45 // estimate or due to that the send pacer is full. Fraction loss and rtt is
49 // also part of this callback to allow the observer to optimize its settings 46 // also part of this callback to allow the observer to optimize its settings
50 // for different types of network environments. The bitrate does not include 47 // for different types of network environments. The bitrate does not include
51 // packet headers and is measured in bits per second. 48 // packet headers and is measured in bits per second.
52 class Observer { 49 class Observer {
53 public: 50 public:
54 virtual void OnNetworkChanged(uint32_t bitrate_bps, 51 virtual void OnNetworkChanged(uint32_t bitrate_bps,
55 uint8_t fraction_loss, // 0 - 255. 52 uint8_t fraction_loss, // 0 - 255.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 virtual void SignalNetworkState(NetworkState state); 84 virtual void SignalNetworkState(NetworkState state);
88 virtual void SetTransportOverhead(size_t transport_overhead_bytes_per_packet); 85 virtual void SetTransportOverhead(size_t transport_overhead_bytes_per_packet);
89 86
90 virtual BitrateController* GetBitrateController() const; 87 virtual BitrateController* GetBitrateController() const;
91 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( 88 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator(
92 bool send_side_bwe); 89 bool send_side_bwe);
93 virtual int64_t GetPacerQueuingDelayMs() const; 90 virtual int64_t GetPacerQueuingDelayMs() const;
94 // TODO(nisse): Delete this accessor function. The pacer should be 91 // TODO(nisse): Delete this accessor function. The pacer should be
95 // internal to the congestion controller. 92 // internal to the congestion controller.
96 virtual PacedSender* pacer() { return pacer_.get(); } 93 virtual PacedSender* pacer() { return pacer_.get(); }
94 virtual TransportFeedbackObserver* GetTransportFeedbackObserver();
97 RateLimiter* GetRetransmissionRateLimiter(); 95 RateLimiter* GetRetransmissionRateLimiter();
98 void EnablePeriodicAlrProbing(bool enable); 96 void EnablePeriodicAlrProbing(bool enable);
99 97
100 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec 98 // SetAllocatedSendBitrateLimits sets bitrates limits imposed by send codec
101 // settings. 99 // settings.
102 // |min_send_bitrate_bps| is the total minimum send bitrate required by all 100 // |min_send_bitrate_bps| is the total minimum send bitrate required by all
103 // sending streams. This is the minimum bitrate the PacedSender will use. 101 // sending streams. This is the minimum bitrate the PacedSender will use.
104 // Note that CongestionController::OnNetworkChanged can still be called with 102 // Note that CongestionController::OnNetworkChanged can still be called with
105 // a lower bitrate estimate. 103 // a lower bitrate estimate.
106 // |max_padding_bitrate_bps| is the max bitrate the send streams request for 104 // |max_padding_bitrate_bps| is the max bitrate the send streams request for
107 // padding. This can be higher than the current network estimate and tells 105 // padding. This can be higher than the current network estimate and tells
108 // the PacedSender how much it should max pad unless there is real packets to 106 // the PacedSender how much it should max pad unless there is real packets to
109 // send. 107 // send.
110 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps, 108 void SetAllocatedSendBitrateLimits(int min_send_bitrate_bps,
111 int max_padding_bitrate_bps); 109 int max_padding_bitrate_bps);
112 110
113 virtual void OnSentPacket(const rtc::SentPacket& sent_packet); 111 virtual void OnSentPacket(const rtc::SentPacket& sent_packet);
114 112
115 // Implements CallStatsObserver. 113 // Implements CallStatsObserver.
116 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; 114 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override;
117 115
118 // Implements Module. 116 // Implements Module.
119 int64_t TimeUntilNextProcess() override; 117 int64_t TimeUntilNextProcess() override;
120 void Process() override; 118 void Process() override;
121 119
122 // Implements TransportFeedbackObserver.
123 void AddPacket(uint16_t sequence_number,
124 size_t length,
125 const PacedPacketInfo& pacing_info) override;
126 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override;
127 std::vector<PacketFeedback> GetTransportFeedbackVector() const override;
128
129 private: 120 private:
130 class WrappingBitrateEstimator : public RemoteBitrateEstimator { 121 class WrappingBitrateEstimator : public RemoteBitrateEstimator {
131 public: 122 public:
132 WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock); 123 WrappingBitrateEstimator(RemoteBitrateObserver* observer, Clock* clock);
133 124
134 virtual ~WrappingBitrateEstimator() {} 125 virtual ~WrappingBitrateEstimator() {}
135 126
136 void IncomingPacket(int64_t arrival_time_ms, 127 void IncomingPacket(int64_t arrival_time_ms,
137 size_t payload_size, 128 size_t payload_size,
138 const RTPHeader& header) override; 129 const RTPHeader& header) override;
(...skipping 28 matching lines...) Expand all
167 158
168 void MaybeTriggerOnNetworkChanged(); 159 void MaybeTriggerOnNetworkChanged();
169 160
170 bool IsSendQueueFull() const; 161 bool IsSendQueueFull() const;
171 bool IsNetworkDown() const; 162 bool IsNetworkDown() const;
172 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, 163 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps,
173 uint8_t fraction_loss, 164 uint8_t fraction_loss,
174 int64_t rtt); 165 int64_t rtt);
175 Clock* const clock_; 166 Clock* const clock_;
176 Observer* const observer_; 167 Observer* const observer_;
177 RtcEventLog* const event_log_;
178 PacketRouter* const packet_router_; 168 PacketRouter* const packet_router_;
179 const std::unique_ptr<PacedSender> pacer_; 169 const std::unique_ptr<PacedSender> pacer_;
180 const std::unique_ptr<BitrateController> bitrate_controller_; 170 const std::unique_ptr<BitrateController> bitrate_controller_;
181 const std::unique_ptr<ProbeController> probe_controller_; 171 const std::unique_ptr<ProbeController> probe_controller_;
182 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_; 172 const std::unique_ptr<RateLimiter> retransmission_rate_limiter_;
183 WrappingBitrateEstimator remote_bitrate_estimator_; 173 WrappingBitrateEstimator remote_bitrate_estimator_;
184 RemoteEstimatorProxy remote_estimator_proxy_; 174 RemoteEstimatorProxy remote_estimator_proxy_;
185 TransportFeedbackAdapter transport_feedback_adapter_; 175 TransportFeedbackAdapter transport_feedback_adapter_;
186 int min_bitrate_bps_; 176 int min_bitrate_bps_;
187 int max_bitrate_bps_; 177 int max_bitrate_bps_;
188 rtc::CriticalSection network_state_lock_; 178 rtc::CriticalSection critsect_;
189 uint32_t last_reported_bitrate_bps_ GUARDED_BY(network_state_lock_); 179 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_);
190 uint8_t last_reported_fraction_loss_ GUARDED_BY(network_state_lock_); 180 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_);
191 int64_t last_reported_rtt_ GUARDED_BY(network_state_lock_); 181 int64_t last_reported_rtt_ GUARDED_BY(critsect_);
192 NetworkState network_state_ GUARDED_BY(network_state_lock_); 182 NetworkState network_state_ GUARDED_BY(critsect_);
193 rtc::CriticalSection bwe_lock_;
194 std::unique_ptr<DelayBasedBwe> delay_based_bwe_ GUARDED_BY(bwe_lock_);
195
196 rtc::ThreadChecker worker_thread_checker_;
197 183
198 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); 184 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController);
199 }; 185 };
200 186
201 } // namespace webrtc 187 } // namespace webrtc
202 188
203 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ 189 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698