diff --git a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc index 0dc3322771..9edf3ed281 100644 --- a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc @@ -102,16 +102,6 @@ class RtxLoopBackTransport : public webrtc::Transport { uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11]; if (ssrc == rtx_ssrc_) count_rtx_ssrc_++; uint16_t sequence_number = (ptr[2] << 8) + ptr[3]; - expected_sequence_numbers_.insert(expected_sequence_numbers_.end(), - sequence_number); - if (packet_loss_ > 0) { - if ((count_ % packet_loss_) == 0) { - return static_cast(len); - } - } else if (count_ >= consecutive_drop_start_ && - count_ < consecutive_drop_end_) { - return static_cast(len); - } size_t packet_length = len; // TODO(pbos): Figure out why this needs to be initialized. Likely this // is hiding a bug either in test setup or other code. @@ -123,6 +113,21 @@ class RtxLoopBackTransport : public webrtc::Transport { if (!parser->Parse(ptr, len, &header)) { return -1; } + + if (!rtp_payload_registry_->IsRtx(header)) { + // Don't store retransmitted packets since we compare it to the list + // created by the receiver. + expected_sequence_numbers_.insert(expected_sequence_numbers_.end(), + sequence_number); + } + if (packet_loss_ > 0) { + if ((count_ % packet_loss_) == 0) { + return static_cast(len); + } + } else if (count_ >= consecutive_drop_start_ && + count_ < consecutive_drop_end_) { + return static_cast(len); + } if (rtp_payload_registry_->IsRtx(header)) { // Remove the RTX header and parse the original RTP header. EXPECT_TRUE(rtp_payload_registry_->RestoreOriginalPacket( @@ -257,7 +262,9 @@ class RtpRtcpRtxNackTest : public ::testing::Test { receiver_.sequence_numbers_.end(), std::back_inserter(received_sorted)); received_sorted.sort(); - return std::equal(received_sorted.begin(), received_sorted.end(), + return received_sorted.size() == + transport_.expected_sequence_numbers_.size() && + std::equal(received_sorted.begin(), received_sorted.end(), transport_.expected_sequence_numbers_.begin()); }