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 12 matching lines...) Expand all Loading... |
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. | 31 // TODO(perkj): BitrateObserver has been deprecated and is not used in WebRTC. |
32 // |observer| is left for project that is not yet updated. | 32 // |observer| is left for project that is not yet updated. |
33 BitrateControllerImpl(Clock* clock, BitrateObserver* observer); | 33 BitrateControllerImpl(Clock* clock, |
| 34 BitrateObserver* observer, |
| 35 RtcEventLog* event_log); |
34 virtual ~BitrateControllerImpl() {} | 36 virtual ~BitrateControllerImpl() {} |
35 | 37 |
36 bool AvailableBandwidth(uint32_t* bandwidth) const override; | 38 bool AvailableBandwidth(uint32_t* bandwidth) const override; |
37 | 39 |
38 RtcpBandwidthObserver* CreateRtcpBandwidthObserver() override; | 40 RtcpBandwidthObserver* CreateRtcpBandwidthObserver() override; |
39 | 41 |
40 // Deprecated | 42 // Deprecated |
41 void SetStartBitrate(int start_bitrate_bps) override; | 43 void SetStartBitrate(int start_bitrate_bps) override; |
42 // Deprecated | 44 // Deprecated |
43 void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) override; | 45 void SetMinMaxBitrate(int min_bitrate_bps, int max_bitrate_bps) override; |
44 | 46 |
45 void SetBitrates(int start_bitrate_bps, | 47 void SetBitrates(int start_bitrate_bps, |
46 int min_bitrate_bps, | 48 int min_bitrate_bps, |
47 int max_bitrate_bps) override; | 49 int max_bitrate_bps) override; |
48 | 50 |
49 void ResetBitrates(int bitrate_bps, | 51 void ResetBitrates(int bitrate_bps, |
50 int min_bitrate_bps, | 52 int min_bitrate_bps, |
51 int max_bitrate_bps) override; | 53 int max_bitrate_bps) override; |
52 | 54 |
53 void UpdateDelayBasedEstimate(uint32_t bitrate_bps) override; | 55 void UpdateDelayBasedEstimate(uint32_t bitrate_bps) override; |
54 | 56 |
55 void SetReservedBitrate(uint32_t reserved_bitrate_bps) override; | 57 void SetReservedBitrate(uint32_t reserved_bitrate_bps) override; |
56 | 58 |
57 void SetEventLog(RtcEventLog* event_log) override; | |
58 | |
59 // Returns true if the parameters have changed since the last call. | 59 // Returns true if the parameters have changed since the last call. |
60 bool GetNetworkParameters(uint32_t* bitrate, | 60 bool GetNetworkParameters(uint32_t* bitrate, |
61 uint8_t* fraction_loss, | 61 uint8_t* fraction_loss, |
62 int64_t* rtt) override; | 62 int64_t* rtt) override; |
63 | 63 |
64 int64_t TimeUntilNextProcess() override; | 64 int64_t TimeUntilNextProcess() override; |
65 void Process() override; | 65 void Process() override; |
66 | 66 |
67 private: | 67 private: |
68 class RtcpBandwidthObserverImpl; | 68 class RtcpBandwidthObserverImpl; |
(...skipping 10 matching lines...) Expand all Loading... |
79 void MaybeTriggerOnNetworkChanged(); | 79 void MaybeTriggerOnNetworkChanged(); |
80 | 80 |
81 void OnNetworkChanged(uint32_t bitrate, | 81 void OnNetworkChanged(uint32_t bitrate, |
82 uint8_t fraction_loss, // 0 - 255. | 82 uint8_t fraction_loss, // 0 - 255. |
83 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 83 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
84 | 84 |
85 // Used by process thread. | 85 // Used by process thread. |
86 Clock* const clock_; | 86 Clock* const clock_; |
87 BitrateObserver* const observer_; | 87 BitrateObserver* const observer_; |
88 int64_t last_bitrate_update_ms_; | 88 int64_t last_bitrate_update_ms_; |
| 89 RtcEventLog* const event_log_; |
89 | 90 |
90 rtc::CriticalSection critsect_; | 91 rtc::CriticalSection critsect_; |
91 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); | 92 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); |
92 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); | 93 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); |
93 | 94 |
94 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); | 95 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); |
95 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); | 96 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); |
96 int64_t last_rtt_ms_ GUARDED_BY(critsect_); | 97 int64_t last_rtt_ms_ GUARDED_BY(critsect_); |
97 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); | 98 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); |
98 | 99 |
99 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); | 100 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); |
100 }; | 101 }; |
101 } // namespace webrtc | 102 } // namespace webrtc |
102 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ | 103 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ |
OLD | NEW |