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

Unified Diff: webrtc/call/bitrate_allocator.h

Issue 2996643002: BWE allocation strategy
Patch Set: BWE allocation strategy Created 3 years, 3 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 9d97720629b14998cdf7cbea3669da1e72bc03ea..ea3810ed371c6f8fdb832013248baa9e56668756 100644
--- a/webrtc/call/bitrate_allocator.h
+++ b/webrtc/call/bitrate_allocator.h
@@ -14,10 +14,13 @@
#include <stdint.h>
#include <map>
+#include <set>
+#include <string>
#include <utility>
#include <vector>
-#include <string>
+#include "webrtc/rtc_base/bitrateallocationstrategy.h"
+#include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/rtc_base/sequenced_task_checker.h"
namespace webrtc {
@@ -94,40 +97,42 @@ class BitrateAllocator {
// the list of added observers, a best guess is returned.
int GetStartBitrate(BitrateAllocatorObserver* observer);
+ // Sets external allocation strategy. If strategy is not set default WEBRTC
+ // allocation mechanism will be used. The strategy may be changed during call.
+ // Setting NULL value will restore default WEBRTC allocation strategy.
+ void SetBitrateAllocationStrategy(
+ rtc::scoped_refptr<rtc::BitrateAllocationStrategy>
+ bitrate_allocation_strategy);
+
private:
// Note: All bitrates for member variables and methods are in bps.
- struct ObserverConfig {
+ struct ObserverConfig : rtc::BitrateAllocationStrategy::TrackConfig {
ObserverConfig(BitrateAllocatorObserver* observer,
uint32_t min_bitrate_bps,
uint32_t max_bitrate_bps,
uint32_t pad_up_bitrate_bps,
bool enforce_min_bitrate,
std::string track_id)
- : observer(observer),
- min_bitrate_bps(min_bitrate_bps),
- max_bitrate_bps(max_bitrate_bps),
+ : TrackConfig(min_bitrate_bps,
+ max_bitrate_bps,
+ enforce_min_bitrate,
+ track_id),
+ observer(observer),
pad_up_bitrate_bps(pad_up_bitrate_bps),
- enforce_min_bitrate(enforce_min_bitrate),
allocated_bitrate_bps(-1),
- media_ratio(1.0),
- track_id(track_id) {}
+ media_ratio(1.0) {}
BitrateAllocatorObserver* observer;
- uint32_t min_bitrate_bps;
- uint32_t max_bitrate_bps;
uint32_t pad_up_bitrate_bps;
- bool enforce_min_bitrate;
int64_t allocated_bitrate_bps;
double media_ratio; // Part of the total bitrate used for media [0.0, 1.0].
- std::string track_id;
};
// Calculates the minimum requested send bitrate and max padding bitrate and
// calls LimitObserver::OnAllocationLimitsChanged.
void UpdateAllocationLimits();
- typedef std::vector<ObserverConfig> ObserverConfigs;
- ObserverConfigs::iterator FindObserverConfig(
+ rtc::BitrateAllocationStrategy::TrackConfigs::iterator FindObserverConfig(
const BitrateAllocatorObserver* observer);
typedef std::multimap<uint32_t, const ObserverConfig*> ObserverSortingMap;
@@ -160,7 +165,8 @@ class BitrateAllocator {
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(&sequenced_checker_);
+ rtc::BitrateAllocationStrategy::TrackConfigs 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_);
@@ -172,6 +178,8 @@ class BitrateAllocator {
int64_t last_bwe_log_time_ GUARDED_BY(&sequenced_checker_);
uint32_t total_requested_padding_bitrate_ GUARDED_BY(&sequenced_checker_);
uint32_t total_requested_min_bitrate_ GUARDED_BY(&sequenced_checker_);
+ rtc::scoped_refptr<rtc::BitrateAllocationStrategy>
+ bitrate_allocation_strategy_ GUARDED_BY(&sequenced_checker_);
};
} // namespace webrtc
#endif // WEBRTC_CALL_BITRATE_ALLOCATOR_H_

Powered by Google App Engine
This is Rietveld 408576698