| Index: webrtc/call/bitrate_allocator.cc
|
| diff --git a/webrtc/call/bitrate_allocator.cc b/webrtc/call/bitrate_allocator.cc
|
| index 34b06b1984e34fbf179b3684166c20642843ea99..19c4cfab6b12d6f25a0954ac58e663dcc01c36fe 100644
|
| --- a/webrtc/call/bitrate_allocator.cc
|
| +++ b/webrtc/call/bitrate_allocator.cc
|
| @@ -54,7 +54,9 @@ BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer)
|
| last_rtt_(0),
|
| num_pause_events_(0),
|
| clock_(Clock::GetRealTimeClock()),
|
| - last_bwe_log_time_(0) {}
|
| + last_bwe_log_time_(0) {
|
| + sequenced_checker_.Detach();
|
| +}
|
|
|
| BitrateAllocator::~BitrateAllocator() {
|
| RTC_LOGGED_HISTOGRAM_COUNTS_100("WebRTC.Call.NumberOfPauseEvents",
|
| @@ -64,7 +66,7 @@ BitrateAllocator::~BitrateAllocator() {
|
| void BitrateAllocator::OnNetworkChanged(uint32_t target_bitrate_bps,
|
| uint8_t fraction_loss,
|
| int64_t rtt) {
|
| - rtc::CritScope lock(&crit_sect_);
|
| + RTC_DCHECK(sequenced_checker_.CalledSequentially());
|
| last_bitrate_bps_ = target_bitrate_bps;
|
| last_non_zero_bitrate_bps_ =
|
| target_bitrate_bps > 0 ? target_bitrate_bps : last_non_zero_bitrate_bps_;
|
| @@ -117,7 +119,7 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
|
| uint32_t max_bitrate_bps,
|
| uint32_t pad_up_bitrate_bps,
|
| bool enforce_min_bitrate) {
|
| - rtc::CritScope lock(&crit_sect_);
|
| + RTC_DCHECK(sequenced_checker_.CalledSequentially());
|
| auto it = FindObserverConfig(observer);
|
|
|
| // Update settings if the observer already exists, create a new one otherwise.
|
| @@ -155,18 +157,16 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
|
| }
|
|
|
| void BitrateAllocator::UpdateAllocationLimits() {
|
| + RTC_DCHECK(sequenced_checker_.CalledSequentially());
|
| uint32_t total_requested_padding_bitrate = 0;
|
| uint32_t total_requested_min_bitrate = 0;
|
|
|
| - {
|
| - rtc::CritScope lock(&crit_sect_);
|
| for (const auto& config : bitrate_observer_configs_) {
|
| if (config.enforce_min_bitrate) {
|
| total_requested_min_bitrate += config.min_bitrate_bps;
|
| }
|
| total_requested_padding_bitrate += config.pad_up_bitrate_bps;
|
| }
|
| - }
|
|
|
| LOG(LS_INFO) << "UpdateAllocationLimits : total_requested_min_bitrate: "
|
| << total_requested_min_bitrate
|
| @@ -177,18 +177,17 @@ void BitrateAllocator::UpdateAllocationLimits() {
|
| }
|
|
|
| void BitrateAllocator::RemoveObserver(BitrateAllocatorObserver* observer) {
|
| - {
|
| - rtc::CritScope lock(&crit_sect_);
|
| - auto it = FindObserverConfig(observer);
|
| - if (it != bitrate_observer_configs_.end()) {
|
| - bitrate_observer_configs_.erase(it);
|
| + RTC_DCHECK(sequenced_checker_.CalledSequentially());
|
| + auto it = FindObserverConfig(observer);
|
| + if (it != bitrate_observer_configs_.end()) {
|
| + bitrate_observer_configs_.erase(it);
|
| }
|
| - }
|
| +
|
| UpdateAllocationLimits();
|
| }
|
|
|
| int BitrateAllocator::GetStartBitrate(BitrateAllocatorObserver* observer) {
|
| - rtc::CritScope lock(&crit_sect_);
|
| + RTC_DCHECK(sequenced_checker_.CalledSequentially());
|
| const auto& it = FindObserverConfig(observer);
|
| if (it == bitrate_observer_configs_.end()) {
|
| // This observer hasn't been added yet, just give it its fair share.
|
|
|