Have changes to REMB trigger RTCP to be sent immediately.

R=mflodman@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5763 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2014-03-24 17:13:00 +00:00
parent 1e6cb2c5d2
commit 9d4762e8b6
2 changed files with 10 additions and 12 deletions

View File

@ -348,6 +348,9 @@ RTCPSender::SetREMBData(const uint32_t bitrate,
_rembSSRC[i] = SSRC[i];
}
_sendREMB = true;
// Send a REMB immediately if we have a new REMB. The frequency of REMBs is
// throttled by the caller.
_nextTimeToSendRTCP = _clock->TimeInMilliseconds();
return 0;
}
@ -483,14 +486,15 @@ RTCPSender::TimeToSendRTCPReport(const bool sendKeyframeBeforeRTP) const
For audio we use a fix 5 sec interval
For video we use 1 sec interval fo a BW smaller than 360 kbit/s,
technicaly we break the max 5% RTCP BW for video below 10 kbit/s but that should be extreamly rare
technicaly we break the max 5% RTCP BW for video below 10 kbit/s but
that should be extremely rare
From RFC 3550
MAX RTCP BW is 5% if the session BW
A send report is approximately 65 bytes inc CNAME
A report report is approximately 28 bytes
A receiver report is approximately 28 bytes
The RECOMMENDED value for the reduced minimum in seconds is 360
divided by the session bandwidth in kilobits/second. This minimum
@ -552,7 +556,7 @@ From RFC 3550
now += RTCP_SEND_BEFORE_KEY_FRAME_MS;
}
if(now > _nextTimeToSendRTCP)
if(now >= _nextTimeToSendRTCP)
{
return true;

View File

@ -22,8 +22,7 @@
namespace webrtc {
const int kRembSendIntervallMs = 1000;
const unsigned int kRembMinimumBitrateKbps = 50;
const int kRembSendIntervalMs = 200;
// % threshold for if we should send a new REMB asap.
const unsigned int kSendThresholdPercent = 97;
@ -117,7 +116,7 @@ void VieRemb::OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
if (new_remb_bitrate < kSendThresholdPercent * last_send_bitrate_ / 100) {
// The new bitrate estimate is less than kSendThresholdPercent % of the
// last report. Send a REMB asap.
last_remb_time_ = TickTime::MillisecondTimestamp() - kRembSendIntervallMs;
last_remb_time_ = TickTime::MillisecondTimestamp() - kRembSendIntervalMs;
}
}
bitrate_ = bitrate;
@ -125,7 +124,7 @@ void VieRemb::OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
// Calculate total receive bitrate estimate.
int64_t now = TickTime::MillisecondTimestamp();
if (now - last_remb_time_ < kRembSendIntervallMs) {
if (now - last_remb_time_ < kRembSendIntervalMs) {
list_crit_->Leave();
return;
}
@ -145,11 +144,6 @@ void VieRemb::OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
}
last_send_bitrate_ = bitrate_;
// Never send a REMB lower than last_send_bitrate_.
if (last_send_bitrate_ < kRembMinimumBitrateKbps) {
last_send_bitrate_ = kRembMinimumBitrateKbps;
}
list_crit_->Leave();
if (sender) {