Making RemoteRateControl::min_configured_bit_rate_ configurable
The minimum bitrate can now be configured from WrappingBitrateEstimator. BUG=2698 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/5699004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5279 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a9890800e0
commit
e9abd591d7
@ -69,7 +69,8 @@ struct RemoteBitrateEstimatorFactory {
|
||||
|
||||
virtual RemoteBitrateEstimator* Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const;
|
||||
Clock* clock,
|
||||
uint32_t min_bitrate_bps) const;
|
||||
};
|
||||
|
||||
struct AbsoluteSendTimeRemoteBitrateEstimatorFactory
|
||||
@ -79,7 +80,8 @@ struct AbsoluteSendTimeRemoteBitrateEstimatorFactory
|
||||
|
||||
virtual RemoteBitrateEstimator* Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const;
|
||||
Clock* clock,
|
||||
uint32_t min_bitrate_bps) const;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
@ -24,7 +24,8 @@ namespace {
|
||||
class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
|
||||
public:
|
||||
RemoteBitrateEstimatorSingleStream(RemoteBitrateObserver* observer,
|
||||
Clock* clock);
|
||||
Clock* clock,
|
||||
uint32_t min_bitrate_bps);
|
||||
virtual ~RemoteBitrateEstimatorSingleStream() {}
|
||||
|
||||
// Called for each incoming packet. If this is a new SSRC, a new
|
||||
@ -72,9 +73,11 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
|
||||
|
||||
RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock)
|
||||
Clock* clock,
|
||||
uint32_t min_bitrate_bps)
|
||||
: clock_(clock),
|
||||
incoming_bitrate_(500, 8000),
|
||||
remote_rate_(min_bitrate_bps),
|
||||
observer_(observer),
|
||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
last_process_time_(-1) {
|
||||
@ -220,13 +223,17 @@ void RemoteBitrateEstimatorSingleStream::GetSsrcs(
|
||||
|
||||
RemoteBitrateEstimator* RemoteBitrateEstimatorFactory::Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const {
|
||||
return new RemoteBitrateEstimatorSingleStream(observer, clock);
|
||||
Clock* clock,
|
||||
uint32_t min_bitrate_bps) const {
|
||||
return new RemoteBitrateEstimatorSingleStream(observer, clock,
|
||||
min_bitrate_bps);
|
||||
}
|
||||
|
||||
RemoteBitrateEstimator* AbsoluteSendTimeRemoteBitrateEstimatorFactory::Create(
|
||||
RemoteBitrateObserver* observer,
|
||||
Clock* clock) const {
|
||||
return new RemoteBitrateEstimatorSingleStream(observer, clock);
|
||||
Clock* clock,
|
||||
uint32_t min_bitrate_bps) const {
|
||||
return new RemoteBitrateEstimatorSingleStream(observer, clock,
|
||||
min_bitrate_bps);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
@ -17,11 +17,14 @@ namespace webrtc {
|
||||
|
||||
class RemoteBitrateEstimatorSingleTest : public RemoteBitrateEstimatorTest {
|
||||
public:
|
||||
static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
|
||||
|
||||
RemoteBitrateEstimatorSingleTest() {}
|
||||
virtual void SetUp() {
|
||||
bitrate_estimator_.reset(RemoteBitrateEstimatorFactory().Create(
|
||||
bitrate_observer_.get(),
|
||||
&clock_));
|
||||
&clock_,
|
||||
kRemoteBitrateEstimatorMinBitrateBps));
|
||||
}
|
||||
protected:
|
||||
DISALLOW_COPY_AND_ASSIGN(RemoteBitrateEstimatorSingleTest);
|
||||
|
@ -22,8 +22,8 @@ namespace webrtc {
|
||||
|
||||
const unsigned int kDefaultRttMs = 200;
|
||||
|
||||
RemoteRateControl::RemoteRateControl()
|
||||
: min_configured_bit_rate_(30000),
|
||||
RemoteRateControl::RemoteRateControl(uint32_t min_bitrate_bps)
|
||||
: min_configured_bit_rate_(min_bitrate_bps),
|
||||
max_configured_bit_rate_(30000000),
|
||||
current_bit_rate_(max_configured_bit_rate_),
|
||||
max_hold_rate_(0),
|
||||
@ -45,7 +45,7 @@ RemoteRateControl::RemoteRateControl()
|
||||
}
|
||||
|
||||
void RemoteRateControl::Reset() {
|
||||
*this = RemoteRateControl();
|
||||
*this = RemoteRateControl(min_configured_bit_rate_);
|
||||
came_from_state_ = kRcHold;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace webrtc {
|
||||
|
||||
class RemoteRateControl {
|
||||
public:
|
||||
RemoteRateControl();
|
||||
explicit RemoteRateControl(uint32_t min_bitrate_bps);
|
||||
~RemoteRateControl() {}
|
||||
|
||||
void Reset();
|
||||
|
@ -36,6 +36,8 @@ template<typename T> void DeleteElements(T* container) {
|
||||
|
||||
class BweTest::TestedEstimator : public RemoteBitrateObserver {
|
||||
public:
|
||||
static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
|
||||
|
||||
TestedEstimator(const string& test_name,
|
||||
const BweTestConfig::EstimatorConfig& config)
|
||||
: debug_name_(config.debug_name),
|
||||
@ -43,7 +45,8 @@ class BweTest::TestedEstimator : public RemoteBitrateObserver {
|
||||
stats_(),
|
||||
relative_estimator_stats_(),
|
||||
latest_estimate_bps_(-1),
|
||||
estimator_(config.estimator_factory->Create(this, &clock_)),
|
||||
estimator_(config.estimator_factory->Create(
|
||||
this, &clock_, kRemoteBitrateEstimatorMinBitrateBps)),
|
||||
relative_estimator_(NULL),
|
||||
baseline_(BaseLineFileInterface::Create(test_name + "_" + debug_name_,
|
||||
config.update_baseline)) {
|
||||
|
@ -58,6 +58,8 @@ class TestTransport : public Transport {
|
||||
|
||||
class RtcpFormatRembTest : public ::testing::Test {
|
||||
protected:
|
||||
static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
|
||||
|
||||
RtcpFormatRembTest()
|
||||
: over_use_detector_options_(),
|
||||
system_clock_(Clock::GetRealTimeClock()),
|
||||
@ -66,7 +68,8 @@ class RtcpFormatRembTest : public ::testing::Test {
|
||||
remote_bitrate_estimator_(
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
&remote_bitrate_observer_,
|
||||
system_clock_)) {}
|
||||
system_clock_,
|
||||
kRemoteBitrateEstimatorMinBitrateBps)) {}
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
|
@ -251,6 +251,8 @@ class TestTransport : public Transport,
|
||||
|
||||
class RtcpReceiverTest : public ::testing::Test {
|
||||
protected:
|
||||
static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
|
||||
|
||||
RtcpReceiverTest()
|
||||
: over_use_detector_options_(),
|
||||
system_clock_(1335900000),
|
||||
@ -258,7 +260,8 @@ class RtcpReceiverTest : public ::testing::Test {
|
||||
remote_bitrate_estimator_(
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
&remote_bitrate_observer_,
|
||||
&system_clock_)) {
|
||||
&system_clock_,
|
||||
kRemoteBitrateEstimatorMinBitrateBps)) {
|
||||
test_transport_ = new TestTransport();
|
||||
|
||||
RtpRtcp::Configuration configuration;
|
||||
|
@ -272,6 +272,8 @@ class TestTransport : public Transport,
|
||||
|
||||
class RtcpSenderTest : public ::testing::Test {
|
||||
protected:
|
||||
static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
|
||||
|
||||
RtcpSenderTest()
|
||||
: over_use_detector_options_(),
|
||||
clock_(1335900000),
|
||||
@ -281,7 +283,8 @@ class RtcpSenderTest : public ::testing::Test {
|
||||
remote_bitrate_estimator_(
|
||||
RemoteBitrateEstimatorFactory().Create(
|
||||
&remote_bitrate_observer_,
|
||||
&clock_)),
|
||||
&clock_,
|
||||
kRemoteBitrateEstimatorMinBitrateBps)),
|
||||
receive_statistics_(ReceiveStatistics::Create(&clock_)) {
|
||||
test_transport_ = new TestTransport();
|
||||
|
||||
|
@ -77,7 +77,9 @@ class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
|
||||
rtp_parser_->RegisterRtpHeaderExtension(kRtpExtensionTransmissionTimeOffset,
|
||||
kTOffsetExtensionId);
|
||||
AbsoluteSendTimeRemoteBitrateEstimatorFactory rbe_factory;
|
||||
remote_bitrate_estimator_.reset(rbe_factory.Create(this, clock));
|
||||
const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
|
||||
remote_bitrate_estimator_.reset(
|
||||
rbe_factory.Create(this, clock, kRemoteBitrateEstimatorMinBitrateBps));
|
||||
}
|
||||
|
||||
virtual void OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
|
||||
|
@ -33,7 +33,9 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
||||
clock_(clock),
|
||||
process_thread_(process_thread),
|
||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
rbe_(RemoteBitrateEstimatorFactory().Create(observer_, clock_)),
|
||||
min_bitrate_bps_(30000),
|
||||
rbe_(RemoteBitrateEstimatorFactory().Create(observer_, clock_,
|
||||
min_bitrate_bps_)),
|
||||
receive_absolute_send_time_(false) {
|
||||
assert(process_thread_ != NULL);
|
||||
process_thread_->RegisterModule(rbe_.get());
|
||||
@ -51,9 +53,10 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
||||
process_thread_->DeRegisterModule(rbe_.get());
|
||||
if (enable) {
|
||||
rbe_.reset(AbsoluteSendTimeRemoteBitrateEstimatorFactory().Create(
|
||||
observer_, clock_));
|
||||
observer_, clock_, min_bitrate_bps_));
|
||||
} else {
|
||||
rbe_.reset(RemoteBitrateEstimatorFactory().Create(observer_, clock_));
|
||||
rbe_.reset(RemoteBitrateEstimatorFactory().Create(observer_, clock_,
|
||||
min_bitrate_bps_));
|
||||
}
|
||||
process_thread_->RegisterModule(rbe_.get());
|
||||
|
||||
@ -98,6 +101,7 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
||||
Clock* clock_;
|
||||
ProcessThread* process_thread_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
const uint32_t min_bitrate_bps_;
|
||||
scoped_ptr<RemoteBitrateEstimator> rbe_;
|
||||
bool receive_absolute_send_time_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user