diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc index f3c33bf6d7..6e6edf8167 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc @@ -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; diff --git a/webrtc/video_engine/vie_remb.cc b/webrtc/video_engine/vie_remb.cc index 6b0f161d93..d318a4bb25 100644 --- a/webrtc/video_engine/vie_remb.cc +++ b/webrtc/video_engine/vie_remb.cc @@ -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& 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& 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& 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) {