Removes unused reserved bitrate in BitrateController.
This removes the reserved bitrate feature as it is not currently used. This saves debugging time as there is less code to investigate. This also makes it easier to compare the code with the task queue based version which lacks this feature. Bug: webrtc:9586 Change-Id: I207624ceb8d203c88c3d01bfc753d60523f99fe4 Reviewed-on: https://webrtc-review.googlesource.com/92622 Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24357}
This commit is contained in:

committed by
Commit Bot

parent
58b228461d
commit
803e3ff298
@ -63,11 +63,9 @@ BitrateControllerImpl::BitrateControllerImpl(const Clock* clock,
|
||||
last_bitrate_update_ms_(clock_->TimeInMilliseconds()),
|
||||
event_log_(event_log),
|
||||
bandwidth_estimation_(event_log),
|
||||
reserved_bitrate_bps_(0),
|
||||
last_bitrate_bps_(0),
|
||||
last_fraction_loss_(0),
|
||||
last_rtt_ms_(0),
|
||||
last_reserved_bitrate_bps_(0) {
|
||||
last_rtt_ms_(0) {
|
||||
// This calls the observer_ if set, which means that the observer provided by
|
||||
// the user must be ready to accept a bitrate update when it constructs the
|
||||
// controller. We do this to avoid having to keep synchronized initial values
|
||||
@ -119,14 +117,6 @@ void BitrateControllerImpl::ResetBitrates(int bitrate_bps,
|
||||
MaybeTriggerOnNetworkChanged();
|
||||
}
|
||||
|
||||
void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) {
|
||||
{
|
||||
rtc::CritScope cs(&critsect_);
|
||||
reserved_bitrate_bps_ = reserved_bitrate_bps;
|
||||
}
|
||||
MaybeTriggerOnNetworkChanged();
|
||||
}
|
||||
|
||||
// This is called upon reception of REMB or TMMBR.
|
||||
void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) {
|
||||
{
|
||||
@ -248,18 +238,15 @@ bool BitrateControllerImpl::GetNetworkParameters(uint32_t* bitrate,
|
||||
int current_bitrate;
|
||||
bandwidth_estimation_.CurrentEstimate(¤t_bitrate, fraction_loss, rtt);
|
||||
*bitrate = current_bitrate;
|
||||
*bitrate -= std::min(*bitrate, reserved_bitrate_bps_);
|
||||
*bitrate =
|
||||
std::max<uint32_t>(*bitrate, bandwidth_estimation_.GetMinBitrate());
|
||||
|
||||
bool new_bitrate = false;
|
||||
if (*bitrate != last_bitrate_bps_ || *fraction_loss != last_fraction_loss_ ||
|
||||
*rtt != last_rtt_ms_ ||
|
||||
last_reserved_bitrate_bps_ != reserved_bitrate_bps_) {
|
||||
*rtt != last_rtt_ms_) {
|
||||
last_bitrate_bps_ = *bitrate;
|
||||
last_fraction_loss_ = *fraction_loss;
|
||||
last_rtt_ms_ = *rtt;
|
||||
last_reserved_bitrate_bps_ = reserved_bitrate_bps_;
|
||||
new_bitrate = true;
|
||||
}
|
||||
|
||||
@ -280,7 +267,6 @@ bool BitrateControllerImpl::AvailableBandwidth(uint32_t* bandwidth) const {
|
||||
int64_t rtt;
|
||||
bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
|
||||
if (bitrate > 0) {
|
||||
bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_);
|
||||
bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate());
|
||||
*bandwidth = bitrate;
|
||||
return true;
|
||||
|
@ -54,8 +54,6 @@ class BitrateControllerImpl : public BitrateController {
|
||||
int min_bitrate_bps,
|
||||
int max_bitrate_bps) override;
|
||||
|
||||
void SetReservedBitrate(uint32_t reserved_bitrate_bps) override;
|
||||
|
||||
// Returns true if the parameters have changed since the last call.
|
||||
bool GetNetworkParameters(uint32_t* bitrate,
|
||||
uint8_t* fraction_loss,
|
||||
@ -94,12 +92,10 @@ class BitrateControllerImpl : public BitrateController {
|
||||
std::map<uint32_t, uint32_t> ssrc_to_last_received_extended_high_seq_num_
|
||||
RTC_GUARDED_BY(critsect_);
|
||||
SendSideBandwidthEstimation bandwidth_estimation_ RTC_GUARDED_BY(critsect_);
|
||||
uint32_t reserved_bitrate_bps_ RTC_GUARDED_BY(critsect_);
|
||||
|
||||
uint32_t last_bitrate_bps_ RTC_GUARDED_BY(critsect_);
|
||||
uint8_t last_fraction_loss_ RTC_GUARDED_BY(critsect_);
|
||||
int64_t last_rtt_ms_ RTC_GUARDED_BY(critsect_);
|
||||
uint32_t last_reserved_bitrate_bps_ RTC_GUARDED_BY(critsect_);
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BitrateControllerImpl);
|
||||
};
|
||||
|
@ -352,56 +352,6 @@ TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
|
||||
report_blocks.clear();
|
||||
}
|
||||
|
||||
TEST_F(BitrateControllerTest, SetReservedBitrate) {
|
||||
// Receive successively lower REMBs, verify the reserved bitrate is deducted.
|
||||
controller_->SetReservedBitrate(0);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(400000);
|
||||
EXPECT_EQ(200000, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetReservedBitrate(50000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(400000);
|
||||
EXPECT_EQ(150000, bitrate_observer_.last_bitrate_);
|
||||
|
||||
controller_->SetReservedBitrate(0);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(250000);
|
||||
EXPECT_EQ(200000, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetReservedBitrate(50000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(250000);
|
||||
EXPECT_EQ(150000, bitrate_observer_.last_bitrate_);
|
||||
|
||||
controller_->SetReservedBitrate(0);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(200000);
|
||||
EXPECT_EQ(200000, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetReservedBitrate(30000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(200000);
|
||||
EXPECT_EQ(170000, bitrate_observer_.last_bitrate_);
|
||||
|
||||
controller_->SetReservedBitrate(0);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(160000);
|
||||
EXPECT_EQ(160000, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetReservedBitrate(30000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(160000);
|
||||
EXPECT_EQ(130000, bitrate_observer_.last_bitrate_);
|
||||
|
||||
controller_->SetReservedBitrate(0);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(120000);
|
||||
EXPECT_EQ(120000, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetReservedBitrate(10000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(120000);
|
||||
EXPECT_EQ(110000, bitrate_observer_.last_bitrate_);
|
||||
|
||||
controller_->SetReservedBitrate(0);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(120000);
|
||||
EXPECT_EQ(120000, bitrate_observer_.last_bitrate_);
|
||||
controller_->SetReservedBitrate(50000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(120000);
|
||||
// Limited by min bitrate.
|
||||
EXPECT_EQ(100000, bitrate_observer_.last_bitrate_);
|
||||
|
||||
controller_->SetReservedBitrate(10000);
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(1);
|
||||
EXPECT_EQ(100000, bitrate_observer_.last_bitrate_);
|
||||
}
|
||||
|
||||
TEST_F(BitrateControllerTest, TimeoutsWithoutFeedback) {
|
||||
{
|
||||
webrtc::test::ScopedFieldTrials override_field_trials(
|
||||
|
@ -92,8 +92,6 @@ class BitrateController : public Module, public RtcpBandwidthObserver {
|
||||
// this bandwidth excludes packet headers.
|
||||
virtual bool AvailableBandwidth(uint32_t* bandwidth) const = 0;
|
||||
|
||||
virtual void SetReservedBitrate(uint32_t reserved_bitrate_bps) = 0;
|
||||
|
||||
virtual bool GetNetworkParameters(uint32_t* bitrate,
|
||||
uint8_t* fraction_loss,
|
||||
int64_t* rtt) = 0;
|
||||
|
@ -41,7 +41,6 @@ class MockBitrateController : public BitrateController {
|
||||
MOCK_METHOD1(UpdateProbeBitrate, void(uint32_t bitrate_bps));
|
||||
MOCK_METHOD1(SetEventLog, void(RtcEventLog* event_log));
|
||||
MOCK_CONST_METHOD1(AvailableBandwidth, bool(uint32_t* bandwidth));
|
||||
MOCK_METHOD1(SetReservedBitrate, void(uint32_t reserved_bitrate_bps));
|
||||
MOCK_METHOD3(GetNetworkParameters,
|
||||
bool(uint32_t* bitrate, uint8_t* fraction_loss, int64_t* rtt));
|
||||
|
||||
|
Reference in New Issue
Block a user