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