Avoid NACK-list flush error on keyframe packets.

Receiver code used to indicate a flush error even if the incoming packet
is a keyframe, forcing a request of a keyframe. Now it takes this
keyframe into account and doesn't error as the stream is decodable from
this point.

BUG=
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/15549005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6188 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-05-19 15:28:02 +00:00
parent 64339a7069
commit ebb467fdc8
2 changed files with 29 additions and 1 deletions

View File

@ -682,7 +682,8 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet,
if (IsPacketRetransmitted(packet)) {
frame->IncrementNackCount();
}
if (!UpdateNackList(packet.seqNum)) {
if (!UpdateNackList(packet.seqNum) &&
packet.frameType != kVideoFrameKey) {
buffer_return = kFlushIndicator;
}
latest_received_sequence_number_ = LatestSequenceNumber(

View File

@ -2033,4 +2033,31 @@ TEST_F(TestJitterBufferNack, NormalOperationWrap2) {
EXPECT_EQ(65535, list[0]);
}
TEST_F(TestJitterBufferNack, ResetByFutureKeyFrameDoesntError) {
stream_generator_->Init(0, 0, clock_->TimeInMilliseconds());
InsertFrame(kVideoFrameKey);
EXPECT_TRUE(DecodeCompleteFrame());
uint16_t nack_list_size = 0;
bool extended = false;
jitter_buffer_->GetNackList(&nack_list_size, &extended);
EXPECT_EQ(0, nack_list_size);
// Far-into-the-future video frame, could be caused by resetting the encoder
// or otherwise restarting. This should not fail when error when the packet is
// a keyframe, even if all of the nack list needs to be flushed.
stream_generator_->Init(10000, 0, clock_->TimeInMilliseconds());
clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
InsertFrame(kVideoFrameKey);
EXPECT_TRUE(DecodeCompleteFrame());
jitter_buffer_->GetNackList(&nack_list_size, &extended);
EXPECT_EQ(0, nack_list_size);
// Stream should be decodable from this point.
clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
InsertFrame(kVideoFrameDelta);
EXPECT_TRUE(DecodeCompleteFrame());
jitter_buffer_->GetNackList(&nack_list_size, &extended);
EXPECT_EQ(0, nack_list_size);
}
} // namespace webrtc