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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 CongestionController(Clock* clock, | 63 CongestionController(Clock* clock, |
64 Observer* observer, | 64 Observer* observer, |
65 RemoteBitrateObserver* remote_bitrate_observer, | 65 RemoteBitrateObserver* remote_bitrate_observer, |
66 std::unique_ptr<PacketRouter> packet_router, | 66 std::unique_ptr<PacketRouter> packet_router, |
67 std::unique_ptr<PacedSender> pacer); | 67 std::unique_ptr<PacedSender> pacer); |
68 virtual ~CongestionController(); | 68 virtual ~CongestionController(); |
69 | 69 |
70 virtual void SetBweBitrates(int min_bitrate_bps, | 70 virtual void SetBweBitrates(int min_bitrate_bps, |
71 int start_bitrate_bps, | 71 int start_bitrate_bps, |
72 int max_bitrate_bps); | 72 int max_bitrate_bps); |
| 73 // Note the first argument is the bitrate_bps. |
| 74 virtual void ResetBweBitrates(int bitrate_bps, |
| 75 int min_bitrate_bps, |
| 76 int max_bitrate_bps); |
73 virtual void SignalNetworkState(NetworkState state); | 77 virtual void SignalNetworkState(NetworkState state); |
74 virtual BitrateController* GetBitrateController() const; | 78 virtual BitrateController* GetBitrateController() const; |
75 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( | 79 virtual RemoteBitrateEstimator* GetRemoteBitrateEstimator( |
76 bool send_side_bwe); | 80 bool send_side_bwe); |
77 virtual int64_t GetPacerQueuingDelayMs() const; | 81 virtual int64_t GetPacerQueuingDelayMs() const; |
78 virtual PacedSender* pacer() { return pacer_.get(); } | 82 virtual PacedSender* pacer() { return pacer_.get(); } |
79 virtual PacketRouter* packet_router() { return packet_router_.get(); } | 83 virtual PacketRouter* packet_router() { return packet_router_.get(); } |
80 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); | 84 virtual TransportFeedbackObserver* GetTransportFeedbackObserver(); |
81 | 85 |
82 void SetAllocatedSendBitrate(int allocated_bitrate_bps, | 86 void SetAllocatedSendBitrate(int allocated_bitrate_bps, |
(...skipping 10 matching lines...) Expand all Loading... |
93 | 97 |
94 private: | 98 private: |
95 void Init(); | 99 void Init(); |
96 void MaybeTriggerOnNetworkChanged(); | 100 void MaybeTriggerOnNetworkChanged(); |
97 | 101 |
98 bool IsSendQueueFull() const; | 102 bool IsSendQueueFull() const; |
99 bool IsNetworkDown() const; | 103 bool IsNetworkDown() const; |
100 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, | 104 bool HasNetworkParametersToReportChanged(uint32_t bitrate_bps, |
101 uint8_t fraction_loss, | 105 uint8_t fraction_loss, |
102 int64_t rtt); | 106 int64_t rtt); |
| 107 |
| 108 // Makes sure that the bitrate and the min, max values are in valid range. |
| 109 void ClampBitrates(int* bitrate_bps, |
| 110 int* min_bitrate_bps, |
| 111 int* max_bitrate_bps); |
103 Clock* const clock_; | 112 Clock* const clock_; |
104 Observer* const observer_; | 113 Observer* const observer_; |
105 const std::unique_ptr<PacketRouter> packet_router_; | 114 const std::unique_ptr<PacketRouter> packet_router_; |
106 const std::unique_ptr<PacedSender> pacer_; | 115 const std::unique_ptr<PacedSender> pacer_; |
107 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 116 const std::unique_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
108 const std::unique_ptr<BitrateController> bitrate_controller_; | 117 const std::unique_ptr<BitrateController> bitrate_controller_; |
109 RemoteEstimatorProxy remote_estimator_proxy_; | 118 RemoteEstimatorProxy remote_estimator_proxy_; |
110 TransportFeedbackAdapter transport_feedback_adapter_; | 119 TransportFeedbackAdapter transport_feedback_adapter_; |
111 int min_bitrate_bps_; | 120 int min_bitrate_bps_; |
112 rtc::CriticalSection critsect_; | 121 rtc::CriticalSection critsect_; |
113 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); | 122 uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); |
114 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); | 123 uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); |
115 int64_t last_reported_rtt_ GUARDED_BY(critsect_); | 124 int64_t last_reported_rtt_ GUARDED_BY(critsect_); |
116 NetworkState network_state_ GUARDED_BY(critsect_); | 125 NetworkState network_state_ GUARDED_BY(critsect_); |
117 | 126 |
118 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); | 127 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CongestionController); |
119 }; | 128 }; |
120 | 129 |
121 } // namespace webrtc | 130 } // namespace webrtc |
122 | 131 |
123 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ | 132 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_ |
OLD | NEW |