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:
parent
33d5f69d5e
commit
117c119501
@ -79,6 +79,10 @@ void RemoteRateControl::Reset()
|
|||||||
_initializedBitRate = false;
|
_initializedBitRate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RemoteRateControl::ValidEstimate() {
|
||||||
|
return _initializedBitRate;
|
||||||
|
}
|
||||||
|
|
||||||
WebRtc_Word32 RemoteRateControl::SetConfiguredBitRates(WebRtc_UWord32 minBitRateBps, WebRtc_UWord32 maxBitRateBps)
|
WebRtc_Word32 RemoteRateControl::SetConfiguredBitRates(WebRtc_UWord32 minBitRateBps, WebRtc_UWord32 maxBitRateBps)
|
||||||
{
|
{
|
||||||
if (minBitRateBps > maxBitRateBps)
|
if (minBitRateBps > maxBitRateBps)
|
||||||
|
@ -31,6 +31,10 @@ public:
|
|||||||
WebRtc_Word64 nowMS);
|
WebRtc_Word64 nowMS);
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
// Returns true if there is a valid estimate of the incoming bitrate, false
|
||||||
|
// otherwise.
|
||||||
|
bool ValidEstimate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebRtc_UWord32 ChangeBitRate(WebRtc_UWord32 currentBitRate,
|
WebRtc_UWord32 ChangeBitRate(WebRtc_UWord32 currentBitRate,
|
||||||
WebRtc_UWord32 incomingBitRate,
|
WebRtc_UWord32 incomingBitRate,
|
||||||
|
@ -282,7 +282,7 @@ bool RTCPSender::SetRemoteBitrateObserver(RtpRemoteBitrateObserver* observer) {
|
|||||||
|
|
||||||
void RTCPSender::UpdateRemoteBitrateEstimate(unsigned int target_bitrate) {
|
void RTCPSender::UpdateRemoteBitrateEstimate(unsigned int target_bitrate) {
|
||||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
if (_bitrate_observer && _remoteSSRC != 0) {
|
if (_bitrate_observer) {
|
||||||
_bitrate_observer->OnReceiveBitrateChanged(_remoteSSRC, target_bitrate);
|
_bitrate_observer->OnReceiveBitrateChanged(_remoteSSRC, target_bitrate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1191,12 +1191,19 @@ RTCPSender::BuildREMB(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos)
|
|||||||
WebRtc_UWord32
|
WebRtc_UWord32
|
||||||
RTCPSender::CalculateNewTargetBitrate(WebRtc_UWord32 RTT)
|
RTCPSender::CalculateNewTargetBitrate(WebRtc_UWord32 RTT)
|
||||||
{
|
{
|
||||||
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
WebRtc_UWord32 target_bitrate =
|
WebRtc_UWord32 target_bitrate =
|
||||||
_remoteRateControl.TargetBitRate(RTT, _clock.GetTimeInMS());
|
_remoteRateControl.TargetBitRate(RTT, _clock.GetTimeInMS());
|
||||||
_tmmbr_Send = target_bitrate / 1000;
|
_tmmbr_Send = target_bitrate / 1000;
|
||||||
return target_bitrate;
|
return target_bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
RTCPSender::ValidBitrateEstimate() {
|
||||||
|
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||||
|
return _remoteRateControl.ValidEstimate();
|
||||||
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
RTCPSender::BuildTMMBR(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos)
|
RTCPSender::BuildTMMBR(WebRtc_UWord8* rtcpbuffer, WebRtc_UWord32& pos)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,10 @@ public:
|
|||||||
|
|
||||||
WebRtc_UWord32 CalculateNewTargetBitrate(WebRtc_UWord32 RTT);
|
WebRtc_UWord32 CalculateNewTargetBitrate(WebRtc_UWord32 RTT);
|
||||||
|
|
||||||
|
// Returns true if there is a valid estimate of the incoming bitrate, false
|
||||||
|
// otherwise.
|
||||||
|
bool ValidBitrateEstimate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebRtc_Word32 SendToNetwork(const WebRtc_UWord8* dataBuffer,
|
WebRtc_Word32 SendToNetwork(const WebRtc_UWord8* dataBuffer,
|
||||||
const WebRtc_UWord16 length);
|
const WebRtc_UWord16 length);
|
||||||
|
@ -415,7 +415,7 @@ WebRtc_Word32 ModuleRtpRtcpImpl::Process()
|
|||||||
{
|
{
|
||||||
WebRtc_UWord16 RTT = 0;
|
WebRtc_UWord16 RTT = 0;
|
||||||
_rtcpReceiver.RTT(_rtpReceiver.SSRC(), &RTT, NULL, NULL, NULL);
|
_rtcpReceiver.RTT(_rtpReceiver.SSRC(), &RTT, NULL, NULL, NULL);
|
||||||
if (REMB())
|
if (REMB() && _rtcpSender.ValidBitrateEstimate())
|
||||||
{
|
{
|
||||||
unsigned int target_bitrate =
|
unsigned int target_bitrate =
|
||||||
_rtcpSender.CalculateNewTargetBitrate(RTT);
|
_rtcpSender.CalculateNewTargetBitrate(RTT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user