Enables configuration of transmission max bitrate multiplier and fec protection level.
Bug: webrtc:8963 Change-Id: I5e323f3947f84f87791a42024a4168f721ac6094 Reviewed-on: https://webrtc-review.googlesource.com/59142 Commit-Queue: Ying Wang <yinwa@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22273}
This commit is contained in:
parent
13e743419d
commit
a646d30820
@ -126,6 +126,7 @@ rtc_source_set("bitrate_allocator") {
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../rtc_base:sequenced_task_checker",
|
||||
"../system_wrappers",
|
||||
"../system_wrappers:field_trial_api",
|
||||
"../system_wrappers:metrics_api",
|
||||
]
|
||||
if (!build_with_chromium && is_clang) {
|
||||
|
||||
@ -20,16 +20,14 @@
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Allow packets to be transmitted in up to 2 times max video bitrate if the
|
||||
// bandwidth estimate allows it.
|
||||
// TODO(bugs.webrtc.org/8541): May be worth to refactor to keep this logic in
|
||||
// video send stream. Similar logic is implemented in
|
||||
// AudioPriorityBitrateAllocationStrategy.
|
||||
const int kTransmissionMaxBitrateMultiplier = 2;
|
||||
const uint8_t kTransmissionMaxBitrateMultiplier = 2;
|
||||
const int kDefaultBitrateBps = 300000;
|
||||
|
||||
// Require a bitrate increase of max(10%, 20kbps) to resume paused streams.
|
||||
@ -61,7 +59,9 @@ BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer)
|
||||
last_bwe_log_time_(0),
|
||||
total_requested_padding_bitrate_(0),
|
||||
total_requested_min_bitrate_(0),
|
||||
bitrate_allocation_strategy_(nullptr) {
|
||||
bitrate_allocation_strategy_(nullptr),
|
||||
transmission_max_bitrate_multiplier_(
|
||||
GetTransmissionMaxBitrateMultiplier()) {
|
||||
sequenced_checker_.Detach();
|
||||
}
|
||||
|
||||
@ -70,6 +70,17 @@ BitrateAllocator::~BitrateAllocator() {
|
||||
num_pause_events_);
|
||||
}
|
||||
|
||||
uint8_t BitrateAllocator::GetTransmissionMaxBitrateMultiplier() {
|
||||
uint64_t multiplier = strtoul(webrtc::field_trial::FindFullName(
|
||||
"WebRTC-TransmissionMaxBitrateMultiplier")
|
||||
.c_str(),
|
||||
nullptr, 10);
|
||||
if (multiplier > 0 && multiplier <= kTransmissionMaxBitrateMultiplier) {
|
||||
return static_cast<uint8_t>(multiplier);
|
||||
}
|
||||
return kTransmissionMaxBitrateMultiplier;
|
||||
}
|
||||
|
||||
void BitrateAllocator::OnNetworkChanged(uint32_t target_bitrate_bps,
|
||||
uint8_t fraction_loss,
|
||||
int64_t rtt,
|
||||
@ -302,7 +313,7 @@ BitrateAllocator::ObserverAllocation BitrateAllocator::AllocateBitrates(
|
||||
if (bitrate <= sum_max_bitrates)
|
||||
return NormalRateAllocation(bitrate, sum_min_bitrates);
|
||||
|
||||
// All observers will get up to kTransmissionMaxBitrateMultiplier x max.
|
||||
// All observers will get up to transmission_max_bitrate_multiplier_ x max.
|
||||
return MaxRateAllocation(bitrate, sum_max_bitrates);
|
||||
}
|
||||
|
||||
@ -406,7 +417,7 @@ BitrateAllocator::ObserverAllocation BitrateAllocator::MaxRateAllocation(
|
||||
allocation[observer_config.observer] = observer_config.max_bitrate_bps;
|
||||
bitrate -= observer_config.max_bitrate_bps;
|
||||
}
|
||||
DistributeBitrateEvenly(bitrate, true, kTransmissionMaxBitrateMultiplier,
|
||||
DistributeBitrateEvenly(bitrate, true, transmission_max_bitrate_multiplier_,
|
||||
&allocation);
|
||||
return allocation;
|
||||
}
|
||||
|
||||
@ -188,6 +188,13 @@ class BitrateAllocator {
|
||||
const ObserverAllocation& observers_capacities,
|
||||
ObserverAllocation* allocation);
|
||||
|
||||
// Allow packets to be transmitted in up to 2 times max video bitrate if the
|
||||
// bandwidth estimate allows it.
|
||||
// TODO(bugs.webrtc.org/8541): May be worth to refactor to keep this logic in
|
||||
// video send stream. Similar logic is implemented in
|
||||
// AudioPriorityBitrateAllocationStrategy.
|
||||
uint8_t GetTransmissionMaxBitrateMultiplier();
|
||||
|
||||
rtc::SequencedTaskChecker sequenced_checker_;
|
||||
LimitObserver* const limit_observer_ RTC_GUARDED_BY(&sequenced_checker_);
|
||||
// Stored in a list to keep track of the insertion order.
|
||||
@ -205,6 +212,7 @@ class BitrateAllocator {
|
||||
uint32_t total_requested_min_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
|
||||
std::unique_ptr<rtc::BitrateAllocationStrategy> bitrate_allocation_strategy_
|
||||
RTC_GUARDED_BY(&sequenced_checker_);
|
||||
uint8_t transmission_max_bitrate_multiplier_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user