提交 9ba4fd6b authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Improve NACK sending

上级 865d06fc
...@@ -24,9 +24,10 @@ namespace RTC ...@@ -24,9 +24,10 @@ namespace RTC
struct NackInfo struct NackInfo
{ {
NackInfo() {}; NackInfo() {};
explicit NackInfo(uint32_t seq32); explicit NackInfo(uint32_t seq32, uint32_t send_at_seq_num);
uint32_t seq32 = 0; uint32_t seq32 = 0;
uint32_t send_at_seq_num = 0;
uint64_t sent_at_time = 0; uint64_t sent_at_time = 0;
uint8_t retries = 0; uint8_t retries = 0;
}; };
...@@ -67,8 +68,9 @@ namespace RTC ...@@ -67,8 +68,9 @@ namespace RTC
// Inline instance methods. // Inline instance methods.
inline inline
NackGenerator::NackInfo::NackInfo(uint32_t seq32) : NackGenerator::NackInfo::NackInfo(uint32_t seq32, uint32_t send_at_seq_num) :
seq32(seq32) seq32(seq32),
send_at_seq_num(send_at_seq_num)
{} {}
} }
......
...@@ -120,7 +120,11 @@ namespace RTC ...@@ -120,7 +120,11 @@ namespace RTC
for (uint32_t seq32 = seq32_start; seq32 != seq32_end; ++seq32) for (uint32_t seq32 = seq32_start; seq32 != seq32_end; ++seq32)
{ {
NackInfo nack_info(seq32); // NOTE: Let the packet become out of order for a while without requesting
// it into a NACK.
uint32_t send_at_seq_num = seq32 + 2;
NackInfo nack_info(seq32, send_at_seq_num);
MS_ASSERT(this->nack_list.find(seq32) == this->nack_list.end(), "packet already in the NACK list"); MS_ASSERT(this->nack_list.find(seq32) == this->nack_list.end(), "packet already in the NACK list");
...@@ -139,7 +143,10 @@ namespace RTC ...@@ -139,7 +143,10 @@ namespace RTC
NackInfo& nack_info = it->second; NackInfo& nack_info = it->second;
uint16_t seq = nack_info.seq32 % (1<<16); uint16_t seq = nack_info.seq32 % (1<<16);
if (filter == NackFilter::SEQ && nack_info.sent_at_time == 0) if (
filter == NackFilter::SEQ &&
nack_info.sent_at_time == 0 &&
this->last_seq32 >= nack_info.send_at_seq_num)
{ {
nack_info.retries++; nack_info.retries++;
nack_info.sent_at_time = now; nack_info.sent_at_time = now;
...@@ -160,7 +167,9 @@ namespace RTC ...@@ -160,7 +167,9 @@ namespace RTC
continue; continue;
} }
if (filter == NackFilter::TIME && nack_info.sent_at_time + this->rtt < now) if (
filter == NackFilter::TIME &&
nack_info.sent_at_time + this->rtt < now)
{ {
nack_info.retries++; nack_info.retries++;
nack_info.sent_at_time = now; nack_info.sent_at_time = now;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论