Tracking packet feedback availability in BitrateAllocator.
This CL adds tracking of packet feedback availability in the BitrateAllocator class. This is part of a series of CLs tracking the transport feedback status of the streams known to BitrateAllocator and reporting the status to the congestion controller. Bug: webrtc:8415 Change-Id: Ie46d7040494ba116928d791a8e4c5dae6992cafc Reviewed-on: https://webrtc-review.googlesource.com/63202 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22534}
This commit is contained in:
parent
fe617a3af1
commit
29b204ede8
@ -59,6 +59,7 @@ BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer)
|
|||||||
last_bwe_log_time_(0),
|
last_bwe_log_time_(0),
|
||||||
total_requested_padding_bitrate_(0),
|
total_requested_padding_bitrate_(0),
|
||||||
total_requested_min_bitrate_(0),
|
total_requested_min_bitrate_(0),
|
||||||
|
has_packet_feedback_(false),
|
||||||
bitrate_allocation_strategy_(nullptr),
|
bitrate_allocation_strategy_(nullptr),
|
||||||
transmission_max_bitrate_multiplier_(
|
transmission_max_bitrate_multiplier_(
|
||||||
GetTransmissionMaxBitrateMultiplier()) {
|
GetTransmissionMaxBitrateMultiplier()) {
|
||||||
@ -145,7 +146,8 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
|
|||||||
uint32_t pad_up_bitrate_bps,
|
uint32_t pad_up_bitrate_bps,
|
||||||
bool enforce_min_bitrate,
|
bool enforce_min_bitrate,
|
||||||
std::string track_id,
|
std::string track_id,
|
||||||
double bitrate_priority) {
|
double bitrate_priority,
|
||||||
|
bool has_packet_feedback) {
|
||||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_checker_);
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_checker_);
|
||||||
RTC_DCHECK_GT(bitrate_priority, 0);
|
RTC_DCHECK_GT(bitrate_priority, 0);
|
||||||
RTC_DCHECK(std::isnormal(bitrate_priority));
|
RTC_DCHECK(std::isnormal(bitrate_priority));
|
||||||
@ -161,7 +163,7 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer,
|
|||||||
} else {
|
} else {
|
||||||
bitrate_observer_configs_.push_back(ObserverConfig(
|
bitrate_observer_configs_.push_back(ObserverConfig(
|
||||||
observer, min_bitrate_bps, max_bitrate_bps, pad_up_bitrate_bps,
|
observer, min_bitrate_bps, max_bitrate_bps, pad_up_bitrate_bps,
|
||||||
enforce_min_bitrate, track_id, bitrate_priority));
|
enforce_min_bitrate, track_id, bitrate_priority, has_packet_feedback));
|
||||||
}
|
}
|
||||||
|
|
||||||
ObserverAllocation allocation;
|
ObserverAllocation allocation;
|
||||||
@ -193,7 +195,7 @@ void BitrateAllocator::UpdateAllocationLimits() {
|
|||||||
uint32_t total_requested_padding_bitrate = 0;
|
uint32_t total_requested_padding_bitrate = 0;
|
||||||
uint32_t total_requested_min_bitrate = 0;
|
uint32_t total_requested_min_bitrate = 0;
|
||||||
uint32_t total_requested_bitrate = 0;
|
uint32_t total_requested_bitrate = 0;
|
||||||
|
bool has_packet_feedback = false;
|
||||||
for (const auto& config : bitrate_observer_configs_) {
|
for (const auto& config : bitrate_observer_configs_) {
|
||||||
uint32_t stream_padding = config.pad_up_bitrate_bps;
|
uint32_t stream_padding = config.pad_up_bitrate_bps;
|
||||||
if (config.enforce_min_bitrate) {
|
if (config.enforce_min_bitrate) {
|
||||||
@ -204,23 +206,27 @@ void BitrateAllocator::UpdateAllocationLimits() {
|
|||||||
}
|
}
|
||||||
total_requested_padding_bitrate += stream_padding;
|
total_requested_padding_bitrate += stream_padding;
|
||||||
total_requested_bitrate += config.max_bitrate_bps;
|
total_requested_bitrate += config.max_bitrate_bps;
|
||||||
|
if (config.allocated_bitrate_bps > 0 && config.has_packet_feedback)
|
||||||
|
has_packet_feedback = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total_requested_padding_bitrate == total_requested_padding_bitrate_ &&
|
if (total_requested_padding_bitrate == total_requested_padding_bitrate_ &&
|
||||||
total_requested_min_bitrate == total_requested_min_bitrate_) {
|
total_requested_min_bitrate == total_requested_min_bitrate_ &&
|
||||||
|
has_packet_feedback == has_packet_feedback_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
total_requested_min_bitrate_ = total_requested_min_bitrate;
|
total_requested_min_bitrate_ = total_requested_min_bitrate;
|
||||||
total_requested_padding_bitrate_ = total_requested_padding_bitrate;
|
total_requested_padding_bitrate_ = total_requested_padding_bitrate;
|
||||||
|
has_packet_feedback_ = has_packet_feedback;
|
||||||
|
|
||||||
RTC_LOG(LS_INFO) << "UpdateAllocationLimits : total_requested_min_bitrate: "
|
RTC_LOG(LS_INFO) << "UpdateAllocationLimits : total_requested_min_bitrate: "
|
||||||
<< total_requested_min_bitrate
|
<< total_requested_min_bitrate
|
||||||
<< "bps, total_requested_padding_bitrate: "
|
<< "bps, total_requested_padding_bitrate: "
|
||||||
<< total_requested_padding_bitrate << "bps";
|
<< total_requested_padding_bitrate << "bps";
|
||||||
limit_observer_->OnAllocationLimitsChanged(total_requested_min_bitrate,
|
limit_observer_->OnAllocationLimitsChanged(
|
||||||
total_requested_padding_bitrate,
|
total_requested_min_bitrate, total_requested_padding_bitrate,
|
||||||
total_requested_bitrate, true);
|
total_requested_bitrate, has_packet_feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitrateAllocator::RemoveObserver(BitrateAllocatorObserver* observer) {
|
void BitrateAllocator::RemoveObserver(BitrateAllocatorObserver* observer) {
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class BitrateAllocator {
|
|||||||
int64_t rtt,
|
int64_t rtt,
|
||||||
int64_t bwe_period_ms);
|
int64_t bwe_period_ms);
|
||||||
|
|
||||||
// Set the start and max send bitrate used by the bandwidth management.
|
// Set the configuration used by the bandwidth management.
|
||||||
//
|
//
|
||||||
// |observer| updates bitrates if already in use.
|
// |observer| updates bitrates if already in use.
|
||||||
// |min_bitrate_bps| = 0 equals no min bitrate.
|
// |min_bitrate_bps| = 0 equals no min bitrate.
|
||||||
@ -78,17 +78,23 @@ class BitrateAllocator {
|
|||||||
// |enforce_min_bitrate| = 'true' will allocate at least |min_bitrate_bps| for
|
// |enforce_min_bitrate| = 'true' will allocate at least |min_bitrate_bps| for
|
||||||
// this observer, even if the BWE is too low, 'false' will allocate 0 to
|
// this observer, even if the BWE is too low, 'false' will allocate 0 to
|
||||||
// the observer if BWE doesn't allow |min_bitrate_bps|.
|
// the observer if BWE doesn't allow |min_bitrate_bps|.
|
||||||
// Note that |observer|->OnBitrateUpdated() will be called within the scope of
|
// |has_packet_feedback| indicates whether the data produced by the
|
||||||
// this method with the current rtt, fraction_loss and available bitrate and
|
// corresponding media stream will receive per packet feedback. This is
|
||||||
// that the bitrate in OnBitrateUpdated will be zero if the |observer| is
|
// tracked here to communicate to limit observers whether packet feedback can
|
||||||
// currently not allowed to send data.
|
// be expected, which is true if any of the active observers has packet
|
||||||
|
// feedback enabled. Note that |observer|->OnBitrateUpdated() will be called
|
||||||
|
// within the scope of this method with the current rtt, fraction_loss and
|
||||||
|
// available bitrate and that the bitrate in OnBitrateUpdated will be zero if
|
||||||
|
// the |observer| is currently not allowed to send data.
|
||||||
void AddObserver(BitrateAllocatorObserver* observer,
|
void AddObserver(BitrateAllocatorObserver* observer,
|
||||||
uint32_t min_bitrate_bps,
|
uint32_t min_bitrate_bps,
|
||||||
uint32_t max_bitrate_bps,
|
uint32_t max_bitrate_bps,
|
||||||
uint32_t pad_up_bitrate_bps,
|
uint32_t pad_up_bitrate_bps,
|
||||||
bool enforce_min_bitrate,
|
bool enforce_min_bitrate,
|
||||||
std::string track_id,
|
std::string track_id,
|
||||||
double bitrate_priority);
|
double bitrate_priority,
|
||||||
|
// TODO(srte): Remove default when callers have been fixed.
|
||||||
|
bool has_packet_feedback = false);
|
||||||
|
|
||||||
// Removes a previously added observer, but will not trigger a new bitrate
|
// Removes a previously added observer, but will not trigger a new bitrate
|
||||||
// allocation.
|
// allocation.
|
||||||
@ -113,7 +119,8 @@ class BitrateAllocator {
|
|||||||
uint32_t pad_up_bitrate_bps,
|
uint32_t pad_up_bitrate_bps,
|
||||||
bool enforce_min_bitrate,
|
bool enforce_min_bitrate,
|
||||||
std::string track_id,
|
std::string track_id,
|
||||||
double bitrate_priority)
|
double bitrate_priority,
|
||||||
|
bool has_packet_feedback)
|
||||||
: TrackConfig(min_bitrate_bps,
|
: TrackConfig(min_bitrate_bps,
|
||||||
max_bitrate_bps,
|
max_bitrate_bps,
|
||||||
enforce_min_bitrate,
|
enforce_min_bitrate,
|
||||||
@ -122,7 +129,8 @@ class BitrateAllocator {
|
|||||||
pad_up_bitrate_bps(pad_up_bitrate_bps),
|
pad_up_bitrate_bps(pad_up_bitrate_bps),
|
||||||
allocated_bitrate_bps(-1),
|
allocated_bitrate_bps(-1),
|
||||||
media_ratio(1.0),
|
media_ratio(1.0),
|
||||||
bitrate_priority(bitrate_priority) {}
|
bitrate_priority(bitrate_priority),
|
||||||
|
has_packet_feedback(has_packet_feedback) {}
|
||||||
|
|
||||||
BitrateAllocatorObserver* observer;
|
BitrateAllocatorObserver* observer;
|
||||||
uint32_t pad_up_bitrate_bps;
|
uint32_t pad_up_bitrate_bps;
|
||||||
@ -132,6 +140,7 @@ class BitrateAllocator {
|
|||||||
// observers. If an observer has twice the bitrate_priority of other
|
// observers. If an observer has twice the bitrate_priority of other
|
||||||
// observers, it should be allocated twice the bitrate above its min.
|
// observers, it should be allocated twice the bitrate above its min.
|
||||||
double bitrate_priority;
|
double bitrate_priority;
|
||||||
|
bool has_packet_feedback;
|
||||||
|
|
||||||
uint32_t LastAllocatedBitrate() const;
|
uint32_t LastAllocatedBitrate() const;
|
||||||
// The minimum bitrate required by this observer, including
|
// The minimum bitrate required by this observer, including
|
||||||
@ -211,6 +220,7 @@ class BitrateAllocator {
|
|||||||
int64_t last_bwe_log_time_ RTC_GUARDED_BY(&sequenced_checker_);
|
int64_t last_bwe_log_time_ RTC_GUARDED_BY(&sequenced_checker_);
|
||||||
uint32_t total_requested_padding_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
|
uint32_t total_requested_padding_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
|
||||||
uint32_t total_requested_min_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
|
uint32_t total_requested_min_bitrate_ RTC_GUARDED_BY(&sequenced_checker_);
|
||||||
|
bool has_packet_feedback_ RTC_GUARDED_BY(&sequenced_checker_);
|
||||||
std::unique_ptr<rtc::BitrateAllocationStrategy> bitrate_allocation_strategy_
|
std::unique_ptr<rtc::BitrateAllocationStrategy> bitrate_allocation_strategy_
|
||||||
RTC_GUARDED_BY(&sequenced_checker_);
|
RTC_GUARDED_BY(&sequenced_checker_);
|
||||||
uint8_t transmission_max_bitrate_multiplier_;
|
uint8_t transmission_max_bitrate_multiplier_;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user