| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // |observer| updates bitrates if already in use. | 53 // |observer| updates bitrates if already in use. |
| 54 // |min_bitrate_bps| = 0 equals no min bitrate. | 54 // |min_bitrate_bps| = 0 equals no min bitrate. |
| 55 // |max_bitrate_bps| = 0 equals no max bitrate. | 55 // |max_bitrate_bps| = 0 equals no max bitrate. |
| 56 // Returns bitrate allocated for the bitrate observer. | 56 // Returns bitrate allocated for the bitrate observer. |
| 57 int AddObserver(BitrateAllocatorObserver* observer, | 57 int AddObserver(BitrateAllocatorObserver* observer, |
| 58 uint32_t min_bitrate_bps, | 58 uint32_t min_bitrate_bps, |
| 59 uint32_t max_bitrate_bps); | 59 uint32_t max_bitrate_bps); |
| 60 | 60 |
| 61 void RemoveObserver(BitrateAllocatorObserver* observer); | 61 void RemoveObserver(BitrateAllocatorObserver* observer); |
| 62 | 62 |
| 63 void GetMinMaxBitrateSumBps(int* min_bitrate_sum_bps, |
| 64 int* max_bitrate_sum_bps) const; |
| 65 |
| 63 // This method controls the behavior when the available bitrate is lower than | 66 // This method controls the behavior when the available bitrate is lower than |
| 64 // the minimum bitrate, or the sum of minimum bitrates. | 67 // the minimum bitrate, or the sum of minimum bitrates. |
| 65 // When true, the bitrate will never be set lower than the minimum bitrate(s). | 68 // When true, the bitrate will never be set lower than the minimum bitrate(s). |
| 66 // When false, the bitrate observers will be allocated rates up to their | 69 // When false, the bitrate observers will be allocated rates up to their |
| 67 // respective minimum bitrate, satisfying one observer after the other. | 70 // respective minimum bitrate, satisfying one observer after the other. |
| 68 void EnforceMinBitrate(bool enforce_min_bitrate); | 71 void EnforceMinBitrate(bool enforce_min_bitrate); |
| 69 | 72 |
| 70 private: | 73 private: |
| 71 struct BitrateConfiguration { | 74 struct BitrateConfiguration { |
| 72 BitrateConfiguration(uint32_t min_bitrate, uint32_t max_bitrate) | 75 BitrateConfiguration(uint32_t min_bitrate, uint32_t max_bitrate) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 typedef std::map<BitrateAllocatorObserver*, int> ObserverBitrateMap; | 90 typedef std::map<BitrateAllocatorObserver*, int> ObserverBitrateMap; |
| 88 | 91 |
| 89 BitrateObserverConfList::iterator FindObserverConfigurationPair( | 92 BitrateObserverConfList::iterator FindObserverConfigurationPair( |
| 90 const BitrateAllocatorObserver* observer) | 93 const BitrateAllocatorObserver* observer) |
| 91 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 94 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 92 ObserverBitrateMap AllocateBitrates() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 95 ObserverBitrateMap AllocateBitrates() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 93 ObserverBitrateMap NormalRateAllocation(uint32_t bitrate, | 96 ObserverBitrateMap NormalRateAllocation(uint32_t bitrate, |
| 94 uint32_t sum_min_bitrates) | 97 uint32_t sum_min_bitrates) |
| 95 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 98 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 96 | 99 |
| 97 ObserverBitrateMap ZeroRateAllocation() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | |
| 98 ObserverBitrateMap LowRateAllocation(uint32_t bitrate) | 100 ObserverBitrateMap LowRateAllocation(uint32_t bitrate) |
| 99 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 101 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| 100 | 102 |
| 101 rtc::CriticalSection crit_sect_; | 103 rtc::CriticalSection crit_sect_; |
| 102 // Stored in a list to keep track of the insertion order. | 104 // Stored in a list to keep track of the insertion order. |
| 103 BitrateObserverConfList bitrate_observers_ GUARDED_BY(crit_sect_); | 105 BitrateObserverConfList bitrate_observers_ GUARDED_BY(crit_sect_); |
| 104 bool bitrate_observers_modified_ GUARDED_BY(crit_sect_); | 106 bool bitrate_observers_modified_ GUARDED_BY(crit_sect_); |
| 105 bool enforce_min_bitrate_ GUARDED_BY(crit_sect_); | 107 bool enforce_min_bitrate_ GUARDED_BY(crit_sect_); |
| 106 uint32_t last_bitrate_bps_ GUARDED_BY(crit_sect_); | 108 uint32_t last_bitrate_bps_ GUARDED_BY(crit_sect_); |
| 107 uint8_t last_fraction_loss_ GUARDED_BY(crit_sect_); | 109 uint8_t last_fraction_loss_ GUARDED_BY(crit_sect_); |
| 108 int64_t last_rtt_ GUARDED_BY(crit_sect_); | 110 int64_t last_rtt_ GUARDED_BY(crit_sect_); |
| 109 }; | 111 }; |
| 110 } // namespace webrtc | 112 } // namespace webrtc |
| 111 #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_ | 113 #endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_ |
| OLD | NEW |