Limit number of send-side BWE increases to one per second.
Also report 0 losses if not enough expected packets since previous receiver report. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/270009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@954 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
3d1ef0c943
commit
fcf33eb7e0
@ -12,10 +12,12 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "rtp_utility.h"
|
#include "rtp_utility.h"
|
||||||
#include "rtp_rtcp_config.h"
|
#include "rtp_rtcp_config.h"
|
||||||
|
#include "tick_util.h"
|
||||||
|
|
||||||
#include <math.h> // sqrt()
|
#include <math.h> // sqrt()
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
BandwidthManagement::BandwidthManagement(const WebRtc_Word32 id) :
|
BandwidthManagement::BandwidthManagement(const WebRtc_Word32 id) :
|
||||||
_id(id),
|
_id(id),
|
||||||
_critsect(*CriticalSectionWrapper::CreateCriticalSection()),
|
_critsect(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
@ -31,7 +33,8 @@ BandwidthManagement::BandwidthManagement(const WebRtc_Word32 id) :
|
|||||||
_last_round_trip_time(0),
|
_last_round_trip_time(0),
|
||||||
_bwEstimateIncoming(0),
|
_bwEstimateIncoming(0),
|
||||||
_smoothedFractionLostQ4(-1), // indicate uninitialized
|
_smoothedFractionLostQ4(-1), // indicate uninitialized
|
||||||
_sFLFactorQ4(14) // 0.875 in Q4
|
_sFLFactorQ4(14), // 0.875 in Q4
|
||||||
|
_timeLastIncrease(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,9 +160,9 @@ WebRtc_Word32 BandwidthManagement::UpdatePacketLoss(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Report same loss as before and keep the accumulators until
|
// Report zero loss until we have enough data to estimate
|
||||||
// the next report.
|
// the loss rate.
|
||||||
*loss = _lastLoss;
|
*loss = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,6 +221,17 @@ WebRtc_UWord32 BandwidthManagement::ShapeSimple(WebRtc_Word32 packetLoss,
|
|||||||
WebRtc_UWord32 newBitRate = 0;
|
WebRtc_UWord32 newBitRate = 0;
|
||||||
bool reducing = false;
|
bool reducing = false;
|
||||||
|
|
||||||
|
// Limit the rate increases to once a second.
|
||||||
|
if (packetLoss <= 5)
|
||||||
|
{
|
||||||
|
if ((TickTime::MillisecondTimestamp() - _timeLastIncrease) <
|
||||||
|
kBWEUpdateIntervalMs)
|
||||||
|
{
|
||||||
|
return _bitRate;
|
||||||
|
}
|
||||||
|
_timeLastIncrease = TickTime::MillisecondTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
if (packetLoss > 5 && packetLoss <= 26)
|
if (packetLoss > 5 && packetLoss <= 26)
|
||||||
{
|
{
|
||||||
// 2% - 10%
|
// 2% - 10%
|
||||||
|
@ -58,6 +58,8 @@ protected:
|
|||||||
WebRtc_Word32 packetLoss);
|
WebRtc_Word32 packetLoss);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum { kBWEUpdateIntervalMs = 1000 };
|
||||||
|
|
||||||
WebRtc_Word32 _id;
|
WebRtc_Word32 _id;
|
||||||
|
|
||||||
CriticalSectionWrapper& _critsect;
|
CriticalSectionWrapper& _critsect;
|
||||||
@ -81,6 +83,7 @@ private:
|
|||||||
WebRtc_UWord32 _bwEstimateIncoming;
|
WebRtc_UWord32 _bwEstimateIncoming;
|
||||||
WebRtc_Word16 _smoothedFractionLostQ4;
|
WebRtc_Word16 _smoothedFractionLostQ4;
|
||||||
WebRtc_Word16 _sFLFactorQ4; // forgetting factor for _smoothedFractionLostQ4
|
WebRtc_Word16 _sFLFactorQ4; // forgetting factor for _smoothedFractionLostQ4
|
||||||
|
WebRtc_Word64 _timeLastIncrease;
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user