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

Unified Diff: webrtc/call/bitrate_allocator.h

Issue 2060403002: Add task queue to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_getpadding
Patch Set: Fix audio thread check when adding audio to bitrateallocator. Created 4 years, 4 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.h
diff --git a/webrtc/call/bitrate_allocator.h b/webrtc/call/bitrate_allocator.h
index 37e15b4f7b016c7315308e98302d90d030dfe32f..a5ed26c71b3bebf697d05f41d6e4190d7719bfa8 100644
--- a/webrtc/call/bitrate_allocator.h
+++ b/webrtc/call/bitrate_allocator.h
@@ -17,8 +17,7 @@
#include <utility>
#include <vector>
-#include "webrtc/base/criticalsection.h"
-#include "webrtc/base/thread_annotations.h"
+#include "webrtc/base/sequenced_task_checker.h"
namespace webrtc {
@@ -121,31 +120,24 @@ class BitrateAllocator {
typedef std::vector<ObserverConfig> ObserverConfigs;
ObserverConfigs::iterator FindObserverConfig(
- const BitrateAllocatorObserver* observer)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ const BitrateAllocatorObserver* observer);
typedef std::multimap<uint32_t, const ObserverConfig*> ObserverSortingMap;
typedef std::map<BitrateAllocatorObserver*, int> ObserverAllocation;
- ObserverAllocation AllocateBitrates(uint32_t bitrate)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ ObserverAllocation AllocateBitrates(uint32_t bitrate);
- ObserverAllocation ZeroRateAllocation() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
- ObserverAllocation LowRateAllocation(uint32_t bitrate)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ ObserverAllocation ZeroRateAllocation();
+ ObserverAllocation LowRateAllocation(uint32_t bitrate);
ObserverAllocation NormalRateAllocation(uint32_t bitrate,
- uint32_t sum_min_bitrates)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ uint32_t sum_min_bitrates);
ObserverAllocation MaxRateAllocation(uint32_t bitrate,
- uint32_t sum_max_bitrates)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ uint32_t sum_max_bitrates);
- uint32_t LastAllocatedBitrate(const ObserverConfig& observer_config)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ uint32_t LastAllocatedBitrate(const ObserverConfig& observer_config);
// The minimum bitrate required by this observer, including enable-hysteresis
// if the observer is in a paused state.
- uint32_t MinBitrateWithHysteresis(const ObserverConfig& observer_config)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ uint32_t MinBitrateWithHysteresis(const ObserverConfig& observer_config);
// Splits |bitrate| evenly to observers already in |allocation|.
// |include_zero_allocations| decides if zero allocations should be part of
// the distribution or not. The allowed max bitrate is |max_multiplier| x
@@ -153,24 +145,22 @@ class BitrateAllocator {
void DistributeBitrateEvenly(uint32_t bitrate,
bool include_zero_allocations,
int max_multiplier,
- ObserverAllocation* allocation)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
- bool EnoughBitrateForAllObservers(uint32_t bitrate, uint32_t sum_min_bitrates)
- EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
+ ObserverAllocation* allocation);
+ bool EnoughBitrateForAllObservers(uint32_t bitrate,
+ uint32_t sum_min_bitrates);
- LimitObserver* const limit_observer_;
-
- rtc::CriticalSection crit_sect_;
+ rtc::SequencedTaskChecker sequenced_checker_;
+ LimitObserver* const limit_observer_ GUARDED_BY(&sequenced_checker_);
// Stored in a list to keep track of the insertion order.
- ObserverConfigs bitrate_observer_configs_ GUARDED_BY(crit_sect_);
- uint32_t last_bitrate_bps_ GUARDED_BY(crit_sect_);
- uint32_t last_non_zero_bitrate_bps_ GUARDED_BY(crit_sect_);
- uint8_t last_fraction_loss_ GUARDED_BY(crit_sect_);
- int64_t last_rtt_ GUARDED_BY(crit_sect_);
+ ObserverConfigs bitrate_observer_configs_ GUARDED_BY(&sequenced_checker_);
+ uint32_t last_bitrate_bps_ GUARDED_BY(&sequenced_checker_);
+ uint32_t last_non_zero_bitrate_bps_ GUARDED_BY(&sequenced_checker_);
+ uint8_t last_fraction_loss_ GUARDED_BY(&sequenced_checker_);
+ int64_t last_rtt_ GUARDED_BY(&sequenced_checker_);
// Number of mute events based on too low BWE, not network up/down.
- int num_pause_events_ GUARDED_BY(crit_sect_);
- Clock* const clock_;
- int64_t last_bwe_log_time_;
+ int num_pause_events_ GUARDED_BY(&sequenced_checker_);
+ Clock* const clock_ GUARDED_BY(&sequenced_checker_);
+ int64_t last_bwe_log_time_ GUARDED_BY(&sequenced_checker_);
};
} // namespace webrtc
#endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_

Powered by Google App Engine
This is Rietveld 408576698