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}
This commit is contained in:
michaelt 2016-11-07 04:17:14 -08:00 committed by Commit bot
parent c285012d3f
commit f082c2aa8d
8 changed files with 41 additions and 18 deletions

View File

@ -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 @@ TEST_F(BitrateControllerTest, DefaultMinMaxBitrate) {
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();

View File

@ -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 kBweDecreaseIntervalMs = 300;
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 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation(RtcEventLog* event_log)
: 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::SetSendBitrate(int bitrate) {
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);

View File

@ -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 @@ static void ClampBitrates(int* bitrate_bps,
// 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 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
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 @@ CongestionController::CongestionController(
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 @@ CongestionController::CongestionController(
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),

View File

@ -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 @@ TEST_F(CongestionControllerTest, ResetBweAndBitrates) {
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);
}

View File

@ -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 double kWithinIncomingBitrateHysteresis = 1.05;
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),

View File

@ -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

View File

@ -19,6 +19,10 @@
namespace webrtc {
namespace congestion_controller {
int GetMinBitrateBps();
} // namespace congestion_controller
static const int64_t kBitrateWindowMs = 1000;
extern const char* kBweTypeHistogram;

View File

@ -44,7 +44,6 @@ struct ReceiveBandwidthEstimatorStats {};
class RemoteBitrateEstimator : public CallStatsObserver, public Module {
public:
static const int kDefaultMinBitrateBps = 30000;
virtual ~RemoteBitrateEstimator() {}
virtual void IncomingPacketFeedbackVector(