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 |
11 * RTCP module. It will aggregate the results and run one bandwidth estimation | 11 * RTCP module. It will aggregate the results and run one bandwidth estimation |
12 * and push the result to the encoder via VideoEncoderCallback. | 12 * and push the result to the encoder via VideoEncoderCallback. |
13 */ | 13 */ |
14 | 14 |
15 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ | 15 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ |
16 #define WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ | 16 #define WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ |
17 | 17 |
18 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 18 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
19 | 19 |
20 #include <list> | 20 #include <list> |
21 #include <utility> | 21 #include <utility> |
22 | 22 |
| 23 #include "webrtc/base/criticalsection.h" |
23 #include "webrtc/base/scoped_ptr.h" | 24 #include "webrtc/base/scoped_ptr.h" |
24 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h" | 25 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h" |
25 #include "webrtc/system_wrappers/interface/critical_section_wrapper.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, BitrateObserver* observer); |
32 virtual ~BitrateControllerImpl() {} | 32 virtual ~BitrateControllerImpl() {} |
33 | 33 |
34 bool AvailableBandwidth(uint32_t* bandwidth) const override; | 34 bool AvailableBandwidth(uint32_t* bandwidth) const override; |
35 | 35 |
(...skipping 21 matching lines...) Expand all Loading... |
57 | 57 |
58 void MaybeTriggerOnNetworkChanged(); | 58 void MaybeTriggerOnNetworkChanged(); |
59 | 59 |
60 // Returns true if the parameters have changed since the last call. | 60 // Returns true if the parameters have changed since the last call. |
61 bool GetNetworkParameters(uint32_t* bitrate, | 61 bool GetNetworkParameters(uint32_t* bitrate, |
62 uint8_t* fraction_loss, | 62 uint8_t* fraction_loss, |
63 int64_t* rtt); | 63 int64_t* rtt); |
64 | 64 |
65 void OnNetworkChanged(uint32_t bitrate, | 65 void OnNetworkChanged(uint32_t bitrate, |
66 uint8_t fraction_loss, // 0 - 255. | 66 uint8_t fraction_loss, // 0 - 255. |
67 int64_t rtt) | 67 int64_t rtt) EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
68 EXCLUSIVE_LOCKS_REQUIRED(*critsect_); | |
69 | 68 |
70 // Used by process thread. | 69 // Used by process thread. |
71 Clock* clock_; | 70 Clock* clock_; |
72 BitrateObserver* observer_; | 71 BitrateObserver* observer_; |
73 int64_t last_bitrate_update_ms_; | 72 int64_t last_bitrate_update_ms_; |
74 | 73 |
75 const rtc::scoped_ptr<CriticalSectionWrapper> critsect_; | 74 mutable rtc::CriticalSection critsect_; |
76 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(*critsect_); | 75 SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(critsect_); |
77 uint32_t reserved_bitrate_bps_ GUARDED_BY(*critsect_); | 76 uint32_t reserved_bitrate_bps_ GUARDED_BY(critsect_); |
78 | 77 |
79 uint32_t last_bitrate_bps_ GUARDED_BY(*critsect_); | 78 uint32_t last_bitrate_bps_ GUARDED_BY(critsect_); |
80 uint8_t last_fraction_loss_ GUARDED_BY(*critsect_); | 79 uint8_t last_fraction_loss_ GUARDED_BY(critsect_); |
81 int64_t last_rtt_ms_ GUARDED_BY(*critsect_); | 80 int64_t last_rtt_ms_ GUARDED_BY(critsect_); |
82 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(*critsect_); | 81 uint32_t last_reserved_bitrate_bps_ GUARDED_BY(critsect_); |
83 | 82 |
84 DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl); |
85 }; | 84 }; |
86 } // namespace webrtc | 85 } // namespace webrtc |
87 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ | 86 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_BITRATE_CONTROLLER_IMPL_H_ |
OLD | NEW |