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

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: Revert changes to gypi. 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..65ca070d149d3ac3fa264f10787e2767998f83a7 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 @@ int 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.
@@ -93,31 +95,28 @@ int 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_) {
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/17 07:59:01 run git cl format
perkj_webrtc 2016/06/27 14:34:34 Done.
- }
+
UpdateAllocationLimits();
}
« no previous file with comments | « webrtc/call/bitrate_allocator.h ('k') | webrtc/call/call.cc » ('j') | webrtc/call/call.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698