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