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

Unified Diff: webrtc/call/bitrate_allocator.cc

Issue 2704323003: Reland of Fixes a bug where a video stream can get stuck in the suspended state. (Closed)
Patch Set: Created 3 years, 10 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 | « webrtc/call/bitrate_allocator.h ('k') | webrtc/call/bitrate_allocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/bitrate_allocator.cc
diff --git a/webrtc/call/bitrate_allocator.cc b/webrtc/call/bitrate_allocator.cc
index 5bd1a2c93edf6902da3e5002405e8a7bc47675aa..c3568df34c65a4595ccea2eb154b493cdeb73e57 100644
--- a/webrtc/call/bitrate_allocator.cc
+++ b/webrtc/call/bitrate_allocator.cc
@@ -54,7 +54,9 @@
last_rtt_(0),
num_pause_events_(0),
clock_(Clock::GetRealTimeClock()),
- last_bwe_log_time_(0) {
+ last_bwe_log_time_(0),
+ total_requested_padding_bitrate_(0),
+ total_requested_min_bitrate_(0) {
sequenced_checker_.Detach();
}
@@ -115,6 +117,7 @@
config.media_ratio = MediaRatio(allocated_bitrate, protection_bitrate);
config.allocated_bitrate_bps = allocated_bitrate;
}
+ UpdateAllocationLimits();
}
void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
@@ -167,11 +170,23 @@
uint32_t total_requested_min_bitrate = 0;
for (const auto& config : bitrate_observer_configs_) {
+ uint32_t stream_padding = config.pad_up_bitrate_bps;
if (config.enforce_min_bitrate) {
total_requested_min_bitrate += config.min_bitrate_bps;
- }
- total_requested_padding_bitrate += config.pad_up_bitrate_bps;
- }
+ } else if (config.allocated_bitrate_bps == 0) {
+ stream_padding =
+ std::max(MinBitrateWithHysteresis(config), stream_padding);
+ }
+ total_requested_padding_bitrate += stream_padding;
+ }
+
+ if (total_requested_padding_bitrate == total_requested_padding_bitrate_ &&
+ total_requested_min_bitrate == total_requested_min_bitrate_) {
+ return;
+ }
+
+ total_requested_min_bitrate_ = total_requested_min_bitrate;
+ total_requested_padding_bitrate_ = total_requested_padding_bitrate;
LOG(LS_INFO) << "UpdateAllocationLimits : total_requested_min_bitrate: "
<< total_requested_min_bitrate
@@ -416,8 +431,9 @@
static_cast<uint32_t>(bitrate_observer_configs_.size());
for (const auto& observer_config : bitrate_observer_configs_) {
if (observer_config.min_bitrate_bps + extra_bitrate_per_observer <
- MinBitrateWithHysteresis(observer_config))
+ MinBitrateWithHysteresis(observer_config)) {
return false;
+ }
}
return true;
}
« no previous file with comments | « webrtc/call/bitrate_allocator.h ('k') | webrtc/call/bitrate_allocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698