OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 int64_t rtt); | 61 int64_t rtt); |
62 | 62 |
63 // Set the start and max send bitrate used by the bandwidth management. | 63 // Set the start and max send bitrate used by the bandwidth management. |
64 // | 64 // |
65 // |observer| updates bitrates if already in use. | 65 // |observer| updates bitrates if already in use. |
66 // |min_bitrate_bps| = 0 equals no min bitrate. | 66 // |min_bitrate_bps| = 0 equals no min bitrate. |
67 // |max_bitrate_bps| = 0 equals no max bitrate. | 67 // |max_bitrate_bps| = 0 equals no max bitrate. |
68 // |enforce_min_bitrate| = 'true' will allocate at least |min_bitrate_bps| for | 68 // |enforce_min_bitrate| = 'true' will allocate at least |min_bitrate_bps| for |
69 // this observer, even if the BWE is too low, 'false' will allocate 0 to | 69 // this observer, even if the BWE is too low, 'false' will allocate 0 to |
70 // the observer if BWE doesn't allow |min_bitrate_bps|. | 70 // the observer if BWE doesn't allow |min_bitrate_bps|. |
71 // Returns initial bitrate allocated for |observer|. | |
72 // Note that |observer|->OnBitrateUpdated() will be called within the scope of | 71 // Note that |observer|->OnBitrateUpdated() will be called within the scope of |
73 // this method with the current rtt, fraction_loss and available bitrate and | 72 // this method with the current rtt, fraction_loss and available bitrate and |
74 // that the bitrate in OnBitrateUpdated will be zero if the |observer| is | 73 // that the bitrate in OnBitrateUpdated will be zero if the |observer| is |
75 // currently not allowed to send data. | 74 // currently not allowed to send data. |
76 int AddObserver(BitrateAllocatorObserver* observer, | 75 void AddObserver(BitrateAllocatorObserver* observer, |
77 uint32_t min_bitrate_bps, | 76 uint32_t min_bitrate_bps, |
78 uint32_t max_bitrate_bps, | 77 uint32_t max_bitrate_bps, |
79 uint32_t pad_up_bitrate_bps, | 78 uint32_t pad_up_bitrate_bps, |
80 bool enforce_min_bitrate); | 79 bool enforce_min_bitrate); |
81 | 80 |
82 // Removes a previously added observer, but will not trigger a new bitrate | 81 // Removes a previously added observer, but will not trigger a new bitrate |
83 // allocation. | 82 // allocation. |
84 void RemoveObserver(BitrateAllocatorObserver* observer); | 83 void RemoveObserver(BitrateAllocatorObserver* observer); |
85 | 84 |
| 85 // Returns initial bitrate allocated for |observer|. If |observer| is not in |
| 86 // the list of added observers, a best guess is returned. |
| 87 int GetStartBitrate(BitrateAllocatorObserver* observer); |
| 88 |
86 private: | 89 private: |
87 // Note: All bitrates for member variables and methods are in bps. | 90 // Note: All bitrates for member variables and methods are in bps. |
88 struct ObserverConfig { | 91 struct ObserverConfig { |
89 ObserverConfig(BitrateAllocatorObserver* observer, | 92 ObserverConfig(BitrateAllocatorObserver* observer, |
90 uint32_t min_bitrate_bps, | 93 uint32_t min_bitrate_bps, |
91 uint32_t max_bitrate_bps, | 94 uint32_t max_bitrate_bps, |
92 uint32_t pad_up_bitrate_bps, | 95 uint32_t pad_up_bitrate_bps, |
93 bool enforce_min_bitrate) | 96 bool enforce_min_bitrate) |
94 : observer(observer), | 97 : observer(observer), |
95 min_bitrate_bps(min_bitrate_bps), | 98 min_bitrate_bps(min_bitrate_bps), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Stored in a list to keep track of the insertion order. | 155 // Stored in a list to keep track of the insertion order. |
153 ObserverConfigList bitrate_observer_configs_ GUARDED_BY(crit_sect_); | 156 ObserverConfigList bitrate_observer_configs_ GUARDED_BY(crit_sect_); |
154 uint32_t last_bitrate_bps_ GUARDED_BY(crit_sect_); | 157 uint32_t last_bitrate_bps_ GUARDED_BY(crit_sect_); |
155 uint32_t last_non_zero_bitrate_bps_ GUARDED_BY(crit_sect_); | 158 uint32_t last_non_zero_bitrate_bps_ GUARDED_BY(crit_sect_); |
156 uint8_t last_fraction_loss_ GUARDED_BY(crit_sect_); | 159 uint8_t last_fraction_loss_ GUARDED_BY(crit_sect_); |
157 int64_t last_rtt_ GUARDED_BY(crit_sect_); | 160 int64_t last_rtt_ GUARDED_BY(crit_sect_); |
158 ObserverAllocation last_allocation_ GUARDED_BY(crit_sect_); | 161 ObserverAllocation last_allocation_ GUARDED_BY(crit_sect_); |
159 }; | 162 }; |
160 } // namespace webrtc | 163 } // namespace webrtc |
161 #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_ | 164 #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_ |
OLD | NEW |