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