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

Unified Diff: webrtc/call/bitrate_allocator.cc

Issue 2060403002: Add task queue to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_getpadding
Patch Set: Rebased. 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 | « webrtc/call/bitrate_allocator.h ('k') | webrtc/call/call.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 e82123a8b09c9069342aa4aaa62e0793d3da5190..dc42322cc4835a127090109af0c12b7af2d1bf95 100644
--- a/webrtc/call/bitrate_allocator.cc
+++ b/webrtc/call/bitrate_allocator.cc
@@ -34,12 +34,14 @@ BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer)
last_bitrate_bps_(kDefaultBitrateBps),
last_non_zero_bitrate_bps_(kDefaultBitrateBps),
last_fraction_loss_(0),
- last_rtt_(0) {}
+ last_rtt_(0) {
+ thread_checker_.DetachFromThread();
+}
void BitrateAllocator::OnNetworkChanged(uint32_t target_bitrate_bps,
uint8_t fraction_loss,
int64_t rtt) {
- rtc::CritScope lock(&crit_sect_);
+ RTC_DCHECK_RUN_ON(&thread_checker_);
last_bitrate_bps_ = target_bitrate_bps;
last_non_zero_bitrate_bps_ =
target_bitrate_bps > 0 ? target_bitrate_bps : last_non_zero_bitrate_bps_;
@@ -58,7 +60,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_RUN_ON(&thread_checker_);
auto it = FindObserverConfig(observer);
// Update settings if the observer already exists, create a new one otherwise.
@@ -92,36 +94,33 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
}
void BitrateAllocator::UpdateAllocationLimits() {
+ RTC_DCHECK_RUN_ON(&thread_checker_);
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_) {
tommi 2016/06/29 14:49:41 run git cl format
if (config.enforce_min_bitrate) {
total_requested_min_bitrate += config.min_bitrate_bps;
}
total_requested_padding_bitrate += config.pad_up_bitrate_bps;
}
- }
limit_observer_->OnAllocationLimitsChanged(total_requested_min_bitrate,
total_requested_padding_bitrate);
}
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_RUN_ON(&thread_checker_);
+ auto it = FindObserverConfig(observer);
+ if (it != bitrate_observer_configs_.end()) {
+ bitrate_observer_configs_.erase(it);
}
tommi 2016/06/29 14:49:41 please :)
- }
+
UpdateAllocationLimits();
}
int BitrateAllocator::GetStartBitrate(BitrateAllocatorObserver* observer) {
- rtc::CritScope lock(&crit_sect_);
+ RTC_DCHECK_RUN_ON(&thread_checker_);
const auto& it = last_allocation_.find(observer);
if (it != last_allocation_.end())
return it->second;
« no previous file with comments | « webrtc/call/bitrate_allocator.h ('k') | webrtc/call/call.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698