Don't try to resend packets that were removed out of order.

Bug: webrtc:11206
Change-Id: Iae05e1db80afd871d37aca203e17bad40dbc9522
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162041
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30083}
This commit is contained in:
Sebastian Jansson 2019-12-13 10:18:35 +01:00 committed by Commit Bot
parent d77c829d37
commit 5e9cac984f
2 changed files with 16 additions and 1 deletions

View File

@ -456,7 +456,8 @@ int RtpPacketHistory::GetPacketIndex(uint16_t sequence_number) const {
RtpPacketHistory::StoredPacket* RtpPacketHistory::GetStoredPacket(
uint16_t sequence_number) {
int index = GetPacketIndex(sequence_number);
if (index < 0 || static_cast<size_t>(index) >= packet_history_.size()) {
if (index < 0 || static_cast<size_t>(index) >= packet_history_.size() ||
packet_history_[index].packet_ == nullptr) {
return nullptr;
}
return &packet_history_[index];

View File

@ -735,6 +735,20 @@ TEST_F(RtpPacketHistoryTest, PayloadPaddingWithEncapsulation) {
EXPECT_EQ(padding_packet->SequenceNumber(), kStartSeqNum + 1);
}
TEST_F(RtpPacketHistoryTest, NackAfterAckIsNoop) {
hist_.SetStorePacketsStatus(StorageMode::kStoreAndCull, 2);
// Add two sent packets.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum),
fake_clock_.TimeInMilliseconds());
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum + 1),
fake_clock_.TimeInMilliseconds());
// Remove newest one.
hist_.CullAcknowledgedPackets(std::vector<uint16_t>{kStartSeqNum + 1});
// Retransmission request for already acked packet, should be noop.
auto packet = hist_.GetPacketAndMarkAsPending(kStartSeqNum + 1);
EXPECT_EQ(packet.get(), nullptr);
}
TEST_F(RtpPacketHistoryTest, OutOfOrderInsertRemoval) {
hist_.SetStorePacketsStatus(StorageMode::kStoreAndCull, 10);