Move BitrateAllocator reference from ViEEncoder to VideoSendStream.
This CL will be followed up with a CL adding AudioSendStream to
BitrateAllocator, so this is a small CL to have the video connection to
BitrateAllocator "at the same level" as for audio.
BUG=webrtc:5079
R=stefan@webrtc.org
Review URL: https://codereview.webrtc.org/1785283002 .
Cr-Commit-Position: refs/heads/master@{#11955}
diff --git a/webrtc/call/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h
index 5028e12..25ca735 100644
--- a/webrtc/call/bitrate_allocator.h
+++ b/webrtc/call/bitrate_allocator.h
@@ -6,10 +6,6 @@
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
- *
- * Usage: this class will register multiple RtcpBitrateObserver's one at each
- * RTCP module. It will aggregate the results and run one bandwidth estimation
- * and push the result to the encoders via BitrateObserver(s).
*/
#ifndef WEBRTC_CALL_BITRATE_ALLOCATOR_H_
@@ -25,13 +21,26 @@
namespace webrtc {
-class BitrateObserver;
+// Used by all send streams with adaptive bitrate, to get the currently
+// allocated bitrate for the send stream. The current network properties are
+// given at the same time, to let the send stream decide about possible loss
+// protection.
+class BitrateAllocatorObserver {
+ public:
+ virtual void OnBitrateUpdated(uint32_t bitrate_bps,
+ uint8_t fraction_loss,
+ int64_t rtt) = 0;
+ virtual ~BitrateAllocatorObserver() {}
+};
+// Usage: this class will register multiple RtcpBitrateObserver's one at each
+// RTCP module. It will aggregate the results and run one bandwidth estimation
+// and push the result to the encoders via BitrateAllocatorObserver(s).
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 +53,11 @@
// |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 +77,20 @@
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)