Tune for faster ramp-up.

BUG=

Review URL: https://webrtc-codereview.appspot.com/789005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2741 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2012-09-11 14:11:58 +00:00
parent 1617f65eec
commit c58be0d217
5 changed files with 19 additions and 21 deletions

View File

@ -590,7 +590,7 @@ struct OverUseDetectorOptions {
initial_e(),
initial_process_noise(),
initial_avg_noise(0.0),
initial_var_noise(500),
initial_var_noise(50),
initial_threshold(25.0) {
initial_e[0][0] = 100;
initial_e[1][1] = 1e-1;

View File

@ -12,7 +12,7 @@
namespace webrtc {
enum { kBitrateAverageWindow = 2000 };
const float kBitrateAverageWindow = 500.0f;
BitRateStats::BitRateStats()
:_dataSamples(), _accumulatedBytes(0)
@ -76,16 +76,8 @@ WebRtc_UWord32 BitRateStats::BitRate(WebRtc_Word64 nowMs)
{
timeOldest = _dataSamples.front()->_timeCompleteMs;
}
// Update average bit rate
float denom = static_cast<float>(nowMs - timeOldest);
if (nowMs == timeOldest)
{
// Calculate with a one second window when we haven't
// received more than one packet.
denom = 1000.0;
}
return static_cast<WebRtc_UWord32>(_accumulatedBytes * 8.0f * 1000.0f /
denom + 0.5f);
kBitrateAverageWindow + 0.5f);
}
} // namespace webrtc

View File

@ -34,8 +34,8 @@ TEST_F(BitRateStatsTest, TestStrictMode)
// Should be initialized to 0.
EXPECT_EQ(0u, bitRate.BitRate(nowMs));
bitRate.Update(1500, nowMs);
// Expecting 12 kbps given a 1000 window with one 1500 bytes packet.
EXPECT_EQ(12000u, bitRate.BitRate(nowMs));
// Expecting 24 kbps given a 500 ms window with one 1500 bytes packet.
EXPECT_EQ(24000u, bitRate.BitRate(nowMs));
bitRate.Init();
// Expecting 0 after init.
EXPECT_EQ(0u, bitRate.BitRate(nowMs));
@ -45,11 +45,11 @@ TEST_F(BitRateStatsTest, TestStrictMode)
bitRate.Update(1500, nowMs);
// Approximately 1200 kbps expected. Not exact since when packets
// are removed we will jump 10 ms to the next packet.
if (nowMs > 0 && nowMs % 2000 == 0)
EXPECT_NEAR(1200000u, bitRate.BitRate(nowMs), 6000u);
if (nowMs > 0 && nowMs % 500 == 0)
EXPECT_NEAR(1200000u, bitRate.BitRate(nowMs), 24000u);
nowMs += 1;
}
nowMs += 2000;
nowMs += 500;
// The window is 2 seconds. If nothing has been received for that time
// the estimate should be 0.
EXPECT_EQ(0u, bitRate.BitRate(nowMs));

View File

@ -220,10 +220,15 @@ TEST_F(RemoteBitrateEstimatorTest, TestInitialBehavior) {
EXPECT_FALSE(bitrate_observer_->updated());
bitrate_observer_->Reset();
// Waiting more than one second gives us a valid estimate.
time_now += 1001;
// We need at least two packets for the incoming bitrate to be > 0 since the
// window is 500 ms.
time_now += 499;
bitrate_estimator_->IncomingPacket(ssrc, kMtu, time_now,
timestamp, -1);
time_now += 2;
bitrate_estimator_->UpdateEstimate(ssrc, time_now);
EXPECT_TRUE(bitrate_estimator_->LatestEstimate(ssrc, &bitrate_bps));
EXPECT_EQ(bitrate_bps, 10734u);
EXPECT_EQ(20607u, bitrate_bps);
EXPECT_TRUE(bitrate_observer_->updated());
bitrate_observer_->Reset();
EXPECT_EQ(bitrate_observer_->latest_bitrate(), bitrate_bps);
@ -231,7 +236,7 @@ TEST_F(RemoteBitrateEstimatorTest, TestInitialBehavior) {
// Make sure we initially increase the bitrate as expected.
TEST_F(RemoteBitrateEstimatorTest, TestRateIncreaseRtpTimestamps) {
const int kExpectedIterations = 323;
const int kExpectedIterations = 277;
unsigned int bitrate_bps = 30000;
unsigned int ssrc = 0;
int iterations = 0;

View File

@ -143,7 +143,8 @@ RateControlRegion RemoteRateControl::Update(const RateControlInput* input,
}
#endif
// Set the initial bit rate value to what we're receiving the first second
// Set the initial bit rate value to what we're receiving the first half
// second.
if (!_initializedBitRate)
{
if (_timeFirstIncomingEstimate < 0)
@ -153,7 +154,7 @@ RateControlRegion RemoteRateControl::Update(const RateControlInput* input,
_timeFirstIncomingEstimate = nowMS;
}
}
else if (nowMS - _timeFirstIncomingEstimate > 1000 &&
else if (nowMS - _timeFirstIncomingEstimate > 500 &&
input->_incomingBitRate > 0)
{
_currentBitRate = input->_incomingBitRate;