Chromium Code Reviews| Index: webrtc/call/bitrate_allocator.h |
| diff --git a/webrtc/call/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h |
| index 5028e124bdfc0f1463669d6e665587182948f816..9e23cdf74094966ac2cee50e80d1caf7102621a9 100644 |
| --- a/webrtc/call/bitrate_allocator.h |
| +++ b/webrtc/call/bitrate_allocator.h |
| @@ -9,7 +9,7 @@ |
| * |
| * Usage: this class will register multiple RtcpBitrateObserver's one at each |
|
stefan-webrtc
2016/03/11 13:43:53
Change this comment to be C++ style and separate i
mflodman
2016/03/11 14:26:05
Done, and moved to the class as in style guide.
|
| * RTCP module. It will aggregate the results and run one bandwidth estimation |
| - * and push the result to the encoders via BitrateObserver(s). |
| + * and push the result to the encoders via BitrateAllocatorObserver(s). |
| */ |
| #ifndef WEBRTC_CALL_BITRATE_ALLOCATOR_H_ |
| @@ -25,13 +25,19 @@ |
| namespace webrtc { |
| -class BitrateObserver; |
| +class BitrateAllocatorObserver { |
|
mflodman
2016/03/11 12:45:03
This is mainly to disconnect the send streams from
stefan-webrtc
2016/03/11 13:43:53
Probably a good idea to make it clear that send st
mflodman
2016/03/11 14:26:05
Done.
|
| + public: |
| + virtual void OnBitrateUpdated(uint32_t bitrate_bps, |
| + uint8_t fraction_loss, |
| + int64_t rtt) = 0; |
| + virtual ~BitrateAllocatorObserver() {} |
| +}; |
| class BitrateAllocator { |
| public: |
| BitrateAllocator(); |
| - // Allocate target_bitrate across the registered BitrateObservers. |
| + // Allocate target_bitrate across the registered BitrateAllocatorObservers. |
| // Returns actual bitrate allocated (might be higher than target_bitrate if |
| // for instance EnforceMinBitrate() is enabled. |
| uint32_t OnNetworkChanged(uint32_t target_bitrate, |
| @@ -44,11 +50,11 @@ class BitrateAllocator { |
| // |min_bitrate_bps| = 0 equals no min bitrate. |
| // |max_bitrate_bps| = 0 equals no max bitrate. |
| // Returns bitrate allocated for the bitrate observer. |
| - int AddBitrateObserver(BitrateObserver* observer, |
| - uint32_t min_bitrate_bps, |
| - uint32_t max_bitrate_bps); |
| + int AddObserver(BitrateAllocatorObserver* observer, |
| + uint32_t min_bitrate_bps, |
| + uint32_t max_bitrate_bps); |
| - void RemoveBitrateObserver(BitrateObserver* observer); |
| + void RemoveObserver(BitrateAllocatorObserver* observer); |
| void GetMinMaxBitrateSumBps(int* min_bitrate_sum_bps, |
| int* max_bitrate_sum_bps) const; |
| @@ -68,19 +74,20 @@ class BitrateAllocator { |
| uint32_t max_bitrate; |
| }; |
| struct ObserverConfiguration { |
| - ObserverConfiguration(BitrateObserver* observer, uint32_t bitrate) |
| + ObserverConfiguration(BitrateAllocatorObserver* observer, uint32_t bitrate) |
| : observer(observer), min_bitrate(bitrate) {} |
| - BitrateObserver* const observer; |
| + BitrateAllocatorObserver* const observer; |
| uint32_t min_bitrate; |
| }; |
| - typedef std::pair<BitrateObserver*, BitrateConfiguration> |
| + typedef std::pair<BitrateAllocatorObserver*, BitrateConfiguration> |
| BitrateObserverConfiguration; |
| typedef std::list<BitrateObserverConfiguration> BitrateObserverConfList; |
| typedef std::multimap<uint32_t, ObserverConfiguration> ObserverSortingMap; |
| - typedef std::map<BitrateObserver*, int> ObserverBitrateMap; |
| + typedef std::map<BitrateAllocatorObserver*, int> ObserverBitrateMap; |
| BitrateObserverConfList::iterator FindObserverConfigurationPair( |
| - const BitrateObserver* observer) EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| + const BitrateAllocatorObserver* observer) |
| + EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| ObserverBitrateMap AllocateBitrates() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
| ObserverBitrateMap NormalRateAllocation(uint32_t bitrate, |
| uint32_t sum_min_bitrates) |