Remove SendPacer from ViEEncoder and make sure SendPacer starts at a valid bitrate
This reverts commit e30c27205148b34ba421184efe65f6a0780b436d (https://codereview.webrtc.org/1958053002/)
Original reverted cl is in patch set #1.
Changes in following patch sets.
The cl now also make sure SendPacer starts with the configured bitrate provided in a call to CongestionController::SetBweBitrates)()
It turns out that the failing tests in 609816 is due to a bug in the current code that runs the proper at 300kbit regardless of configured start bitrate.
Original cl description:
Remove SendPacer from ViEEncoder
This CL moves the logic where the ViEEncoder pause if the pacer is full to the BitrateController. If the queue is full, the controller reports a bitrate of zero to Call (and BitrateAllocator)
BUG=chromium:609816, webrtc:5687
TBR=mflodman@webrtc.org
NOTRY=True // Due to bug in android_x86 cq builder....
Review-Url: https://codereview.webrtc.org/1958113003
Cr-Original-Commit-Position: refs/heads/master@{#12688}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: ec81bcd5198cc09e4332ddeee195a1c992b6a780
diff --git a/call/bitrate_allocator.cc b/call/bitrate_allocator.cc
index 097378f..4c8d2a0 100644
--- a/call/bitrate_allocator.cc
+++ b/call/bitrate_allocator.cc
@@ -54,7 +54,9 @@
uint32_t sum_min_bitrates = 0;
for (const auto& observer : bitrate_observers_)
sum_min_bitrates += observer.second.min_bitrate;
- if (last_bitrate_bps_ <= sum_min_bitrates)
+ if (last_bitrate_bps_ == 0)
+ return ZeroRateAllocation();
+ else if (last_bitrate_bps_ <= sum_min_bitrates)
return LowRateAllocation(last_bitrate_bps_);
else
return NormalRateAllocation(last_bitrate_bps_, sum_min_bitrates);
@@ -104,18 +106,6 @@
}
}
-void BitrateAllocator::GetMinMaxBitrateSumBps(int* min_bitrate_sum_bps,
- int* max_bitrate_sum_bps) const {
- *min_bitrate_sum_bps = 0;
- *max_bitrate_sum_bps = 0;
-
- rtc::CritScope lock(&crit_sect_);
- for (const auto& observer : bitrate_observers_) {
- *min_bitrate_sum_bps += observer.second.min_bitrate;
- *max_bitrate_sum_bps += observer.second.max_bitrate;
- }
-}
-
BitrateAllocator::BitrateObserverConfList::iterator
BitrateAllocator::FindObserverConfigurationPair(
const BitrateAllocatorObserver* observer) {
@@ -170,6 +160,14 @@
return allocation;
}
+BitrateAllocator::ObserverBitrateMap BitrateAllocator::ZeroRateAllocation() {
+ ObserverBitrateMap allocation;
+ // Zero bitrate to all observers.
+ for (const auto& observer : bitrate_observers_)
+ allocation[observer.first] = 0;
+ return allocation;
+}
+
BitrateAllocator::ObserverBitrateMap BitrateAllocator::LowRateAllocation(
uint32_t bitrate) {
ObserverBitrateMap allocation;