From c301ecd20790c539d066908da78c78dede13caf0 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sat, 11 Mar 2023 10:16:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=AE=9Anack=20rtt=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=9C=89=E6=95=88=E5=80=BC=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/Nack.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/webrtc/Nack.cpp b/webrtc/Nack.cpp index 876f9fa1..8012a16c 100644 --- a/webrtc/Nack.cpp +++ b/webrtc/Nack.cpp @@ -205,10 +205,8 @@ void NackContext::clearNackStatus(uint16_t seq) { auto rtt = getCurrentMillisecond() - it->second.first_stamp; _nack_send_status.erase(it); - if (rtt >= 0) { - // rtt不能小于0 - _rtt = rtt; - } + // 限定rtt在合理有效范围内 + _rtt = max(10, min(rtt, kNackMaxMS / kNackMaxCount)); } void NackContext::recordNack(const FCI_NACK &nack) { @@ -280,7 +278,7 @@ uint64_t NackContext::reSendNack() { } // 没有任何包需要重传时返回0,否则返回下次重传间隔(不得低于5ms) - return _nack_send_status.empty() ? 0 : max(_rtt, 5); + return _nack_send_status.empty() ? 0 : _rtt; } } // namespace mediakit