Set min BWE bitrate form 10kbps to 5kbps and centralize minimum bitrate.
BUG=webrtc:6522
Review-Url: https://codereview.webrtc.org/2415543002
Cr-Commit-Position: refs/heads/master@{#14947}
diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc b/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
index 56bb41e..6f6c57d 100644
--- a/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
+++ b/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
@@ -14,7 +14,7 @@
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/pacing/mock/mock_paced_sender.h"
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
+#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "webrtc/test/field_trial.h"
#include "webrtc/test/gtest.h"
@@ -98,7 +98,8 @@
controller_->SetMinMaxBitrate(0, 0);
EXPECT_EQ(kStartBitrateBps, bitrate_observer_.last_bitrate_);
bandwidth_observer_->OnReceivedEstimatedBitrate(kDefaultMinBitrateBps / 2);
- EXPECT_EQ(kDefaultMinBitrateBps, bitrate_observer_.last_bitrate_);
+ EXPECT_EQ(webrtc::congestion_controller::GetMinBitrateBps(),
+ bitrate_observer_.last_bitrate_);
bandwidth_observer_->OnReceivedEstimatedBitrate(2 * kDefaultMaxBitrateBps);
clock_.AdvanceTimeMilliseconds(1000);
controller_->Process();
diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
index b314031..ad8a6f9 100644
--- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
+++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.cc
@@ -16,6 +16,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
+#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "webrtc/system_wrappers/include/field_trial.h"
#include "webrtc/system_wrappers/include/metrics.h"
@@ -26,7 +27,6 @@
const int64_t kStartPhaseMs = 2000;
const int64_t kBweConverganceTimeMs = 20000;
const int kLimitNumPackets = 20;
-const int kDefaultMinBitrateBps = 10000;
const int kDefaultMaxBitrateBps = 1000000000;
const int64_t kLowBitrateLogPeriodMs = 10000;
const int64_t kRtcEventLogPeriodMs = 5000;
@@ -53,7 +53,7 @@
: lost_packets_since_last_loss_update_Q8_(0),
expected_packets_since_last_loss_update_(0),
bitrate_(0),
- min_bitrate_configured_(kDefaultMinBitrateBps),
+ min_bitrate_configured_(congestion_controller::GetMinBitrateBps()),
max_bitrate_configured_(kDefaultMaxBitrateBps),
last_low_bitrate_log_ms_(-1),
has_decreased_since_last_fraction_loss_(false),
@@ -100,7 +100,8 @@
void SendSideBandwidthEstimation::SetMinMaxBitrate(int min_bitrate,
int max_bitrate) {
RTC_DCHECK_GE(min_bitrate, 0);
- min_bitrate_configured_ = std::max(min_bitrate, kDefaultMinBitrateBps);
+ min_bitrate_configured_ =
+ std::max(min_bitrate, congestion_controller::GetMinBitrateBps());
if (max_bitrate > 0) {
max_bitrate_configured_ =
std::max<uint32_t>(min_bitrate_configured_, max_bitrate);
diff --git a/webrtc/modules/congestion_controller/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc
index 6b4e285..f3ce2e5 100644
--- a/webrtc/modules/congestion_controller/congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller.cc
@@ -20,6 +20,7 @@
#include "webrtc/base/socket.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/congestion_controller/probe_controller.h"
+#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h"
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
@@ -37,9 +38,8 @@
// TODO(holmer): We should make sure the default bitrates are set to 10 kbps,
// and that we don't try to set the min bitrate to 0 from any applications.
// The congestion controller should allow a min bitrate of 0.
- const int kMinBitrateBps = 10000;
- if (*min_bitrate_bps < kMinBitrateBps)
- *min_bitrate_bps = kMinBitrateBps;
+ if (*min_bitrate_bps < congestion_controller::GetMinBitrateBps())
+ *min_bitrate_bps = congestion_controller::GetMinBitrateBps();
if (*max_bitrate_bps > 0)
*max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps);
if (*bitrate_bps > 0)
@@ -55,7 +55,7 @@
rbe_(new RemoteBitrateEstimatorSingleStream(observer_, clock_)),
using_absolute_send_time_(false),
packets_since_absolute_send_time_(0),
- min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps) {}
+ min_bitrate_bps_(congestion_controller::GetMinBitrateBps()) {}
virtual ~WrappingBitrateEstimator() {}
@@ -166,7 +166,7 @@
new RateLimiter(clock, kRetransmitWindowSizeMs)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(clock_, bitrate_controller_.get()),
- min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
+ min_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
max_bitrate_bps_(0),
last_reported_bitrate_bps_(0),
last_reported_fraction_loss_(0),
@@ -197,7 +197,7 @@
new RateLimiter(clock, kRetransmitWindowSizeMs)),
remote_estimator_proxy_(clock_, packet_router_.get()),
transport_feedback_adapter_(clock_, bitrate_controller_.get()),
- min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
+ min_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
max_bitrate_bps_(0),
last_reported_bitrate_bps_(0),
last_reported_fraction_loss_(0),
diff --git a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
index 91508df..42bb526 100644
--- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
@@ -13,6 +13,7 @@
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
#include "webrtc/modules/pacing/mock/mock_paced_sender.h"
+#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_observer.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/test/gmock.h"
@@ -135,10 +136,11 @@
controller_->ResetBweAndBitrates(new_bitrate, -1, -1);
// If the bitrate is reset to -1, the new starting bitrate will be
- // the minimum default bitrate 10000bps.
- int min_default_bitrate = 10000;
- EXPECT_CALL(observer_, OnNetworkChanged(min_default_bitrate, _, _));
- EXPECT_CALL(*pacer_, SetEstimatedBitrate(min_default_bitrate));
+ // the minimum default bitrate kMinBitrateBps.
+ EXPECT_CALL(observer_, OnNetworkChanged(
+ congestion_controller::GetMinBitrateBps(), _, _));
+ EXPECT_CALL(*pacer_,
+ SetEstimatedBitrate(congestion_controller::GetMinBitrateBps()));
controller_->ResetBweAndBitrates(-1, -1, -1);
}
diff --git a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
index f83cddc..f4835f5 100644
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
@@ -17,6 +17,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
+#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
@@ -27,8 +28,7 @@
static const int64_t kMaxFeedbackIntervalMs = 1000;
AimdRateControl::AimdRateControl()
- : min_configured_bitrate_bps_(
- RemoteBitrateEstimator::kDefaultMinBitrateBps),
+ : min_configured_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
max_configured_bitrate_bps_(30000000),
current_bitrate_bps_(max_configured_bitrate_bps_),
avg_max_bitrate_kbps_(-1.0f),
diff --git a/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc b/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc
index 3587ebf..69769f0 100644
--- a/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc
+++ b/webrtc/modules/remote_bitrate_estimator/bwe_defines.cc
@@ -7,7 +7,23 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+
+#include "webrtc/system_wrappers/include/field_trial.h"
+
namespace webrtc {
const char* kBweTypeHistogram = "WebRTC.BWE.Types";
+
+namespace congestion_controller {
+int GetMinBitrateBps() {
+ constexpr int kAudioMinBitrateBps = 5000;
+ constexpr int kMinBitrateBps = 10000;
+ if (webrtc::field_trial::FindFullName("WebRTC-Audio-SendSideBwe") ==
+ "Enabled") {
+ return kAudioMinBitrateBps;
+ }
+ return kMinBitrateBps;
+}
+
+} // namespace congestion_controller
} // namespace webrtc
diff --git a/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h b/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h
index fc2278e..26bfb28 100644
--- a/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h
+++ b/webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h
@@ -19,6 +19,10 @@
namespace webrtc {
+namespace congestion_controller {
+int GetMinBitrateBps();
+} // namespace congestion_controller
+
static const int64_t kBitrateWindowMs = 1000;
extern const char* kBweTypeHistogram;
diff --git a/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h b/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h
index dfeedfc..29dd81b 100644
--- a/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h
+++ b/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h
@@ -44,7 +44,6 @@
class RemoteBitrateEstimator : public CallStatsObserver, public Module {
public:
- static const int kDefaultMinBitrateBps = 30000;
virtual ~RemoteBitrateEstimator() {}
virtual void IncomingPacketFeedbackVector(