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 32 matching lines...) Loading... |
43 void SetBitrates(int start_bitrate_bps, | 43 void SetBitrates(int start_bitrate_bps, |
44 int min_bitrate_bps, | 44 int min_bitrate_bps, |
45 int max_bitrate_bps) override; | 45 int max_bitrate_bps) override; |
46 | 46 |
47 void UpdateDelayBasedEstimate(uint32_t bitrate_bps) override; | 47 void UpdateDelayBasedEstimate(uint32_t bitrate_bps) override; |
48 | 48 |
49 void SetReservedBitrate(uint32_t reserved_bitrate_bps) override; | 49 void SetReservedBitrate(uint32_t reserved_bitrate_bps) override; |
50 | 50 |
51 void SetEventLog(RtcEventLog* event_log) override; | 51 void SetEventLog(RtcEventLog* event_log) override; |
52 | 52 |
| 53 // Returns true if the parameters have changed since the last call. |
| 54 bool GetNetworkParameters(uint32_t* bitrate, |
| 55 uint8_t* fraction_loss, |
| 56 int64_t* rtt) override; |
| 57 |
53 int64_t TimeUntilNextProcess() override; | 58 int64_t TimeUntilNextProcess() override; |
54 void Process() override; | 59 void Process() override; |
55 | 60 |
56 private: | 61 private: |
57 class RtcpBandwidthObserverImpl; | 62 class RtcpBandwidthObserverImpl; |
58 | 63 |
59 // Called by BitrateObserver's direct from the RTCP module. | 64 // Called by BitrateObserver's direct from the RTCP module. |
60 void OnReceivedEstimatedBitrate(uint32_t bitrate); | 65 void OnReceivedEstimatedBitrate(uint32_t bitrate); |
61 | 66 |
62 void OnReceivedRtcpReceiverReport(uint8_t fraction_loss, | 67 void OnReceivedRtcpReceiverReport(uint8_t fraction_loss, |
63 int64_t rtt, | 68 int64_t rtt, |
64 int number_of_packets, | 69 int number_of_packets, |
65 int64_t now_ms); | 70 int64_t now_ms); |
66 | 71 |
67 void MaybeTriggerOnNetworkChanged(); | 72 void MaybeTriggerOnNetworkChanged(); |
68 | 73 |
69 // Returns true if the parameters have changed since the last call. | |
70 bool GetNetworkParameters(uint32_t* bitrate, | |
71 uint8_t* fraction_loss, | |
72 int64_t* rtt); | |
73 | |
74 void OnNetworkChanged(uint32_t bitrate, | 74 void OnNetworkChanged(uint32_t bitrate, |
75 uint8_t fraction_loss, // 0 - 255. | 75 uint8_t fraction_loss, // 0 - 255. |
76 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 76 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
77 | 77 |
78 // Used by process thread. | 78 // Used by process thread. |
79 Clock* clock_; | 79 Clock* const clock_; |
80 BitrateObserver* observer_; | 80 BitrateObserver* const observer_; |
81 int64_t last_bitrate_update_ms_; | 81 int64_t last_bitrate_update_ms_; |
82 | 82 |
83 rtc::CriticalSection critsect_; | 83 rtc::CriticalSection critsect_; |
84 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); | 84 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); |
85 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); | 85 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); |
86 | 86 |
87 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); | 87 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); |
88 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); | 88 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); |
89 int64_t last_rtt_ms_ GUARDED_BY(critsect_); | 89 int64_t last_rtt_ms_ GUARDED_BY(critsect_); |
90 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); | 90 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); |
91 | 91 |
92 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); | 92 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); |
93 }; | 93 }; |
94 } // namespace webrtc | 94 } // namespace webrtc |
95 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ | 95 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ |
OLD | NEW |