Skip to content

Commit

Permalink
Fix missing generated nack (lynckia#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trisfald authored and jcague committed Dec 19, 2017
1 parent 1fd68b0 commit acdb9fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions erizo/src/erizo/rtp/RtcpNackGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,24 @@ bool RtcpNackGenerator::addNackPacketToRr(std::shared_ptr<DataPacket> rr_packet)
base_nack_info.sent_time = now_ms;
base_nack_info.retransmits++;
while (index + 1u < nack_info_list_.size()) {
index++;
NackInfo& blp_nack_info = nack_info_list_[index];
NackInfo& blp_nack_info = nack_info_list_[index + 1];
uint16_t distance = blp_nack_info.seq_num - pid -1;
if (distance <= 15) {
if (!isTimeToRetransmit(blp_nack_info, now_ms)) {
index++;
continue;
}
if (blp_nack_info.retransmits >= kMaxRetransmits) {
ELOG_DEBUG("message: Removing Nack in list too many retransmits, ssrc: %u, seq_num: %u",
ssrc_, blp_nack_info.seq_num);
nack_info_list_.erase(nack_info_list_.begin() + index);
nack_info_list_.erase(nack_info_list_.begin() + index + 1);
continue;
}
ELOG_DEBUG("message: Adding Nack to BLP, seq_num: %u", blp_nack_info.seq_num);
blp |= (1 << distance);
blp_nack_info.sent_time = now_ms;
blp_nack_info.retransmits++;
index++;
} else {
break;
}
Expand Down
5 changes: 4 additions & 1 deletion erizo/src/test/rtp/RtcpNackGeneratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ TEST_F(RtcpNackGeneratorTest, nackShouldContainLostPacketsInMoreThanOneBlock) {
EXPECT_TRUE(nack_generator.handleRtpPacket(second_packet));

receiver_report = generateRrWithNack();
EXPECT_TRUE(RtcpPacketContainsNackSeqNum(receiver_report, 35));

for (int i = erizo::kArbitrarySeqNumber + 1; i < erizo::kArbitrarySeqNumber + kArbitraryNumberOfPackets; ++i) {
EXPECT_TRUE(RtcpPacketContainsNackSeqNum(receiver_report, i)) << "i = " << i;
}
}

TEST_F(RtcpNackGeneratorTest, shouldNotRetransmitNacksInmediately) {
Expand Down

0 comments on commit acdb9fa

Please sign in to comment.