Only update REMB value if there is a calid bitrate estimate.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/352005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1421 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2012-01-13 08:52:58 +00:00
parent 33d5f69d5e
commit 117c119501
5 changed files with 21 additions and 2 deletions

View File

@ -79,6 +79,10 @@ void RemoteRateControl::Reset()
_initializedBitRate = false;
}
bool RemoteRateControl::ValidEstimate() {
return _initializedBitRate;
}
WebRtc_Word32 RemoteRateControl::SetConfiguredBitRates(WebRtc_UWord32 minBitRateBps, WebRtc_UWord32 maxBitRateBps)
{
if (minBitRateBps > maxBitRateBps)

View File

@ -31,6 +31,10 @@ public:
WebRtc_Word64 nowMS);
void Reset();
// Returns true if there is a valid estimate of the incoming bitrate, false
// otherwise.
bool ValidEstimate();
private:
WebRtc_UWord32 ChangeBitRate(WebRtc_UWord32 currentBitRate,
WebRtc_UWord32 incomingBitRate,

View File

@ -282,7 +282,7 @@ bool RTCPSender::SetRemoteBitrateObserver(RtpRemoteBitrateObserver* observer) {
void RTCPSender::UpdateRemoteBitrateEstimate(unsigned int target_bitrate) {
CriticalSectionScoped lock(_criticalSectionRTCPSender);
if (_bitrate_observer && _remoteSSRC != 0) {
if (_bitrate_observer) {
_bitrate_observer->OnReceiveBitrateChanged(_remoteSSRC, target_bitrate);
}
}
@ -1191,12 +1191,19 @@ RTCPSender::BuildREMB(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos)
WebRtc_UWord32
RTCPSender::CalculateNewTargetBitrate(WebRtc_UWord32 RTT)
{
CriticalSectionScoped lock(_criticalSectionRTCPSender);
WebRtc_UWord32 target_bitrate =
_remoteRateControl.TargetBitRate(RTT, _clock.GetTimeInMS());
_tmmbr_Send = target_bitrate / 1000;
return target_bitrate;
}
bool
RTCPSender::ValidBitrateEstimate() {
CriticalSectionScoped lock(_criticalSectionRTCPSender);
return _remoteRateControl.ValidEstimate();
}
WebRtc_Word32
RTCPSender::BuildTMMBR(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos)
{

View File

@ -133,6 +133,10 @@ public:
WebRtc_UWord32 CalculateNewTargetBitrate(WebRtc_UWord32 RTT);
// Returns true if there is a valid estimate of the incoming bitrate, false
// otherwise.
bool ValidBitrateEstimate();
private:
WebRtc_Word32 SendToNetwork(const WebRtc_UWord8* dataBuffer,
const WebRtc_UWord16 length);

View File

@ -415,7 +415,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process()
{
WebRtc_UWord16 RTT = 0;
_rtcpReceiver.RTT(_rtpReceiver.SSRC(), &RTT, NULL, NULL, NULL);
if (REMB())
if (REMB() && _rtcpSender.ValidBitrateEstimate())
{
unsigned int target_bitrate =
_rtcpSender.CalculateNewTargetBitrate(RTT);