Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: webrtc/call/bitrate_allocator.h

Issue 2035383002: Implementing auto pausing of video streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/call/bitrate_allocator.cc » ('j') | webrtc/call/bitrate_allocator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/bitrate_allocator.h
diff --git a/webrtc/call/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h
index bf26a6ae9bbc2d035f8dbd51eeab3b300348116c..8151736dfc2533e6e8c467b555133fd8673e1f54 100644
--- a/webrtc/call/bitrate_allocator.h
+++ b/webrtc/call/bitrate_allocator.h
@@ -42,9 +42,9 @@ class BitrateAllocator {
BitrateAllocator();
// 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,
+ // Returns actual bitrate allocated, which might be higher than target_bitrate
+ // if for instance EnforceMinBitrate() is enabled.
+ uint32_t OnNetworkChanged(uint32_t target_bitrate_bps,
uint8_t fraction_loss,
int64_t rtt);
@@ -66,9 +66,12 @@ class BitrateAllocator {
uint32_t max_bitrate_bps,
bool enforce_min_bitrate);
+ // Removes a previously added observer, but will not trigger a new bitrate
pbos-webrtc 2016/06/06 15:26:28 Should this not trigger a new bitrate allocation?
mflodman 2016/06/09 13:23:13 It has never done it and there is no urgency to ac
pbos-webrtc 2016/06/09 13:37:21 Is there a guarantee that a new estimate will come
+ // allocation.
void RemoveObserver(BitrateAllocatorObserver* observer);
private:
+ // Note: All bitrates for member variables and methods are in bps.
struct ObserverConfig {
ObserverConfig(BitrateAllocatorObserver* observer,
uint32_t min_bitrate_bps,
@@ -84,14 +87,6 @@ class BitrateAllocator {
bool enforce_min_bitrate;
};
- // This method controls the behavior when the available bitrate is lower than
- // the minimum bitrate, or the sum of minimum bitrates.
- // When true, the bitrate will never be set lower than the minimum bitrate(s).
- // When false, the bitrate observers will be allocated rates up to their
- // respective minimum bitrate, satisfying one observer after the other.
- void EnforceMinBitrate(bool enforce_min_bitrate)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
-
typedef std::list<ObserverConfig> ObserverConfigList;
ObserverConfigList::iterator FindObserverConfig(
const BitrateAllocatorObserver* observer)
@@ -102,22 +97,41 @@ class BitrateAllocator {
ObserverAllocation AllocateBitrates(uint32_t bitrate)
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+
+ ObserverAllocation ZeroRateAllocation() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ ObserverAllocation LowRateAllocation(uint32_t bitrate)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
ObserverAllocation NormalRateAllocation(uint32_t bitrate,
pbos-webrtc 2016/06/06 15:26:28 _bps on everything here please
mflodman 2016/06/09 13:23:13 See my previous reply.
uint32_t sum_min_bitrates)
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ ObserverAllocation MaxRateAllocation(uint32_t bitrate,
+ uint32_t sum_max_bitrates)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
- ObserverAllocation ZeroRateAllocation() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
- ObserverAllocation LowRateAllocation(uint32_t bitrate)
+ uint32_t LastAllocatedBitrate(const ObserverConfig& observer_config)
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ // The minimum bitrate required by this observer, including enable-hysteresis
+ // if the observer is in a paused state.
+ uint32_t MinBitrateForObserver(const ObserverConfig& observer_config)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ // Splits |bitrate| evenly to all observers with a non-zero bitrate in
+ // |allocation|. The allowed max bitrate is |max_multiplier| x observer max
+ // bitrate.
+ void DistributeBitrateEvenly(
+ uint32_t bitrate, int max_multiplier, ObserverAllocation* allocation)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ bool ShouldDoLowRateAllocation(uint32_t bitrate, uint32_t sum_min_bitrates)
+ EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+
rtc::CriticalSection crit_sect_;
// Stored in a list to keep track of the insertion order.
ObserverConfigList bitrate_observer_configs_ GUARDED_BY(crit_sect_);
- bool enforce_min_bitrate_ GUARDED_BY(crit_sect_);
uint32_t last_bitrate_bps_ GUARDED_BY(crit_sect_);
uint32_t last_non_zero_bitrate_bps_ GUARDED_BY(crit_sect_);
uint8_t last_fraction_loss_ GUARDED_BY(crit_sect_);
int64_t last_rtt_ GUARDED_BY(crit_sect_);
+ ObserverAllocation last_allocation_ GUARDED_BY(crit_sect_);
};
} // namespace webrtc
#endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_
« no previous file with comments | « no previous file | webrtc/call/bitrate_allocator.cc » ('j') | webrtc/call/bitrate_allocator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698