Only reset the last decoded sequence number after flushing until key frame.

We can't reset the complete last decoded state when we recycle until a
key frame because that will allow any delta frame to be decoded afterwards,
and since the decoder isn't reset we will get decode errors.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/330003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1295 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2011-12-23 09:08:51 +00:00
parent 1ce66e4dfb
commit 39670f6aa6
3 changed files with 62 additions and 24 deletions

View File

@@ -1720,8 +1720,7 @@ VCMJitterBuffer::RecycleFramesUntilKeyFrame()
}
// Remove up to oldest key frame
bool foundKeyFrame = false;
while (oldestFrameListItem != NULL && !foundKeyFrame)
while (oldestFrameListItem != NULL)
{
// Throw at least one frame.
_dropCount++;
@@ -1737,21 +1736,15 @@ VCMJitterBuffer::RecycleFramesUntilKeyFrame()
{
oldestFrame = oldestFrameListItem->GetItem();
}
if (oldestFrame != NULL)
if (oldestFrame != NULL && oldestFrame->FrameType() == kVideoFrameKey)
{
foundKeyFrame = foundKeyFrame ||
(oldestFrame->FrameType() != kVideoFrameDelta);
if (foundKeyFrame)
{
// Fake the lastDecodedState to match this key frame.
_lastDecodedState.SetStateOneBack(oldestFrame);
break;
}
// Fake the lastDecodedState to match this key frame.
_lastDecodedState.SetStateOneBack(oldestFrame);
return true;
}
}
_lastDecodedState.Reset(); // TODO (mikhal): no sync
return foundKeyFrame;
return false;
}
// Must be called under the critical section _critSect.