video_coding - JB: Ensuring that every frame is inserted only once to the list

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@391 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2011-08-17 18:43:21 +00:00
parent 473bac8582
commit ebeb5a656b
2 changed files with 7 additions and 8 deletions

View File

@ -1702,13 +1702,12 @@ VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
frame->IncrementNackCount(); frame->IncrementNackCount();
} }
// First packet of a frame // Insert each frame once on the arrival of the first packet
if (state == kStateEmpty) // belonging to that frame (media or empty)
{ if (state == kStateEmpty &&
if (bufferReturn > 0) frame->GetHighSeqNum() == packet.seqNum)
{ {
ret = kFirstPacket; ret = kFirstPacket;
}
_frameBuffersTSOrder.Insert(frame); _frameBuffersTSOrder.Insert(frame);
} }
} }
@ -1857,7 +1856,7 @@ VCMJitterBuffer::RecycleFramesUntilKeyFrame()
oldestFrame = oldestFrameListItem->GetItem(); oldestFrame = oldestFrameListItem->GetItem();
} }
if(oldestFrame != NULL) if (oldestFrame != NULL)
{ {
foundIFrame = foundIFrame || foundIFrame = foundIFrame ||
(oldestFrame->FrameType() != kVideoFrameDelta); (oldestFrame->FrameType() != kVideoFrameDelta);

View File

@ -1903,7 +1903,7 @@ int JitterBufferTest(CmdArgs& args)
packet.seqNum = seqNum; packet.seqNum = seqNum;
packet.timestamp = timeStamp; packet.timestamp = timeStamp;
packet.frameType = kVideoFrameDelta; packet.frameType = kVideoFrameDelta;
TEST(kFirstPacket == jb.InsertPacket(frameIn, packet)); TEST(kIncomplete == jb.InsertPacket(frameIn, packet));
// insert an additional data packet // insert an additional data packet
seqNum = 2; seqNum = 2;
packet.isFirstPacket = false; packet.isFirstPacket = false;