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

Unified Diff: webrtc/call/bitrate_allocator.cc

Issue 2070343002: Remove ViEncoder::Pause / Start (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix. 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
Index: webrtc/call/bitrate_allocator.cc
diff --git a/webrtc/call/bitrate_allocator.cc b/webrtc/call/bitrate_allocator.cc
index e20c34e05d560e2d32657600a25d64a8d5838a0e..e82123a8b09c9069342aa4aaa62e0793d3da5190 100644
--- a/webrtc/call/bitrate_allocator.cc
+++ b/webrtc/call/bitrate_allocator.cc
@@ -53,11 +53,11 @@ void BitrateAllocator::OnNetworkChanged(uint32_t target_bitrate_bps,
last_allocation_ = allocation;
}
-int BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
- uint32_t min_bitrate_bps,
- uint32_t max_bitrate_bps,
- uint32_t pad_up_bitrate_bps,
- bool enforce_min_bitrate) {
+void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
+ uint32_t min_bitrate_bps,
+ uint32_t max_bitrate_bps,
+ uint32_t pad_up_bitrate_bps,
+ bool enforce_min_bitrate) {
rtc::CritScope lock(&crit_sect_);
auto it = FindObserverConfig(observer);
@@ -89,7 +89,6 @@ int BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
UpdateAllocationLimits();
last_allocation_ = allocation;
- return allocation[observer];
}
void BitrateAllocator::UpdateAllocationLimits() {
@@ -121,6 +120,18 @@ void BitrateAllocator::RemoveObserver(BitrateAllocatorObserver* observer) {
UpdateAllocationLimits();
}
+int BitrateAllocator::GetStartBitrate(BitrateAllocatorObserver* observer) {
+ rtc::CritScope lock(&crit_sect_);
+ const auto& it = last_allocation_.find(observer);
+ if (it != last_allocation_.end())
+ return it->second;
+
+ // This is a new observer that has not yet been started. Assume that if it is
+ // added, all observers would split the available bitrate evenly.
+ return last_non_zero_bitrate_bps_ /
mflodman 2016/06/17 11:28:17 I think this is good enough for now and I'll open
+ static_cast<int>((bitrate_observer_configs_.size() + 1));
+}
+
BitrateAllocator::ObserverConfigList::iterator
BitrateAllocator::FindObserverConfig(
const BitrateAllocatorObserver* observer) {

Powered by Google App Engine
This is Rietveld 408576698