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 * Usage: this class will register multiple RtcpBitrateObserver's one at each | 10 * Usage: this class will register multiple RtcpBitrateObserver's one at each |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include <utility> | 21 #include <utility> |
22 | 22 |
23 #include "webrtc/base/constructormagic.h" | 23 #include "webrtc/base/constructormagic.h" |
24 #include "webrtc/base/criticalsection.h" | 24 #include "webrtc/base/criticalsection.h" |
25 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h" | 25 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h" |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 | 28 |
29 class BitrateControllerImpl : public BitrateController { | 29 class BitrateControllerImpl : public BitrateController { |
30 public: | 30 public: |
31 BitrateControllerImpl(Clock* clock, BitrateObserver* observer); | 31 BitrateControllerImpl(Clock* clock, |
| 32 BitrateObserver* observer, |
| 33 PacedSender* pacer); |
32 virtual ~BitrateControllerImpl() {} | 34 virtual ~BitrateControllerImpl() {} |
33 | 35 |
34 bool AvailableBandwidth(uint32_t* bandwidth) const override; | 36 bool AvailableBandwidth(uint32_t* bandwidth) const override; |
35 | 37 |
36 RtcpBandwidthObserver* CreateRtcpBandwidthObserver() override; | 38 RtcpBandwidthObserver* CreateRtcpBandwidthObserver() override; |
37 | 39 |
38 void SetStartBitrate(int start_bitrate_bps) override; | 40 void SetStartBitrate(int start_bitrate_bps) override; |
39 void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) override; | 41 void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) override; |
40 | 42 |
41 void UpdateDelayBasedEstimate(uint32_t bitrate_bps) override; | 43 void UpdateDelayBasedEstimate(uint32_t bitrate_bps) override; |
(...skipping 15 matching lines...) Expand all Loading... |
57 int64_t rtt, | 59 int64_t rtt, |
58 int number_of_packets, | 60 int number_of_packets, |
59 int64_t now_ms); | 61 int64_t now_ms); |
60 | 62 |
61 void MaybeTriggerOnNetworkChanged(); | 63 void MaybeTriggerOnNetworkChanged(); |
62 | 64 |
63 // Returns true if the parameters have changed since the last call. | 65 // Returns true if the parameters have changed since the last call. |
64 bool GetNetworkParameters(uint32_t* bitrate, | 66 bool GetNetworkParameters(uint32_t* bitrate, |
65 uint8_t* fraction_loss, | 67 uint8_t* fraction_loss, |
66 int64_t* rtt); | 68 int64_t* rtt); |
| 69 // Updates |send_queue_full_| to |is_full| and returns true if this caused |
| 70 // |send_queue_full_| to be changed. |
| 71 bool UpdateSendQueueStatus(bool is_full); |
67 | 72 |
68 void OnNetworkChanged(uint32_t bitrate, | 73 void OnNetworkChanged(uint32_t bitrate, |
69 uint8_t fraction_loss, // 0 - 255. | 74 uint8_t fraction_loss, // 0 - 255. |
70 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 75 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
71 | 76 |
72 // Used by process thread. | 77 // Used by process thread. |
73 Clock* clock_; | 78 Clock* const clock_; |
74 BitrateObserver* observer_; | 79 BitrateObserver* const observer_; |
| 80 PacedSender* const pacer_; |
75 int64_t last_bitrate_update_ms_; | 81 int64_t last_bitrate_update_ms_; |
76 | 82 |
77 rtc::CriticalSection critsect_; | 83 rtc::CriticalSection critsect_; |
78 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); | 84 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); |
79 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); | 85 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); |
80 | 86 |
81 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); | 87 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); |
82 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); | 88 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); |
83 int64_t last_rtt_ms_ GUARDED_BY(critsect_); | 89 int64_t last_rtt_ms_ GUARDED_BY(critsect_); |
84 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); | 90 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); |
| 91 bool send_queue_full_ GUARDED_BY(critsect_); |
85 | 92 |
86 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); | 93 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); |
87 }; | 94 }; |
88 } // namespace webrtc | 95 } // namespace webrtc |
89 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ | 96 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ |
OLD | NEW |