Avoid NACKing after DTX.

This is done by not adding missing packets to the NACK list if the number of samples per packet is too large.

Bug: webrtc:10178
Change-Id: If46398d6d05ea35f30d7028040d3b808559e950b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231841
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34984}
This commit is contained in:
Jakob Ivarsson
2021-09-13 16:06:28 +02:00
committed by WebRTC LUCI CQ
parent 593b4d550d
commit 018cd3d6fc
3 changed files with 53 additions and 27 deletions

View File

@ -539,4 +539,19 @@ TEST(NackTrackerTest, PacketLossRateCorrect) {
EXPECT_NEAR(nack->GetPacketLossRateForTest(), 1 << 28, (1 << 30) / 100);
}
TEST(NackTrackerTest, DoNotNackAfterDtx) {
const int kNackListSize = 200;
std::unique_ptr<NackTracker> nack(NackTracker::Create(0));
nack->UpdateSampleRate(kSampleRateHz);
nack->SetMaxNackListSize(kNackListSize);
uint16_t seq_num = 0;
uint32_t timestamp = 0x87654321;
nack->UpdateLastReceivedPacket(seq_num, timestamp);
EXPECT_TRUE(nack->GetNackList(0).empty());
constexpr int kDtxPeriod = 400;
nack->UpdateLastReceivedPacket(seq_num + 2,
timestamp + kDtxPeriod * kSampleRateHz / 1000);
EXPECT_TRUE(nack->GetNackList(0).empty());
}
} // namespace webrtc