TransportFeedback must be able to start with dropped packets.

A bug in the transpot feedback adapter causes new feedback message to
always start with a received packet. This makes it impossible for the
receiver to distinguish from actual dropped packets and dropped feedback
messages.

BUG=webrtc:6073
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2122863002 .

Cr-Commit-Position: refs/heads/master@{#13381}
This commit is contained in:
Erik Språng
2016-07-05 12:00:56 +02:00
parent 552866c402
commit 956ed71a11
4 changed files with 63 additions and 14 deletions

View File

@ -317,7 +317,11 @@ void TransportFeedback::WithBase(uint16_t base_sequence,
RTC_DCHECK_EQ(-1, base_seq_);
RTC_DCHECK_NE(-1, ref_timestamp_us);
base_seq_ = base_sequence;
last_seq_ = base_sequence;
// last_seq_ is the sequence number of the last packed added _before_ a call
// to WithReceivedPacket(). Since the first sequence to be added is
// base_sequence, we need this to be one lower in order for potential missing
// packets to be populated properly.
last_seq_ = base_sequence - 1;
base_time_ = ref_timestamp_us / kBaseScaleFactor;
last_timestamp_ = base_time_ * kBaseScaleFactor;
}

View File

@ -359,15 +359,18 @@ TEST(RtcpPacketTest, TransportFeedback_Limits) {
// Sequence number wrap above 0x8000.
std::unique_ptr<TransportFeedback> packet(new TransportFeedback());
packet->WithBase(0, 0);
EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0));
EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000));
packet.reset(new TransportFeedback());
packet->WithBase(0, 0);
EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0));
EXPECT_FALSE(packet->WithReceivedPacket(0x8000 + 1, 1000));
// Packet status count max 0xFFFF.
packet.reset(new TransportFeedback());
packet->WithBase(0, 0);
EXPECT_TRUE(packet->WithReceivedPacket(0x0, 0));
EXPECT_TRUE(packet->WithReceivedPacket(0x8000, 1000));
EXPECT_TRUE(packet->WithReceivedPacket(0xFFFF, 2000));
EXPECT_FALSE(packet->WithReceivedPacket(0, 3000));