video_coding: updates to jitter buffer logic: Make sure that every frame is inserted only once to the list.
Review URL: http://webrtc-codereview.appspot.com/165001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@648 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
cf136186f5
commit
e185e9f68a
@ -1685,6 +1685,9 @@ VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert packet
|
// Insert packet
|
||||||
|
// check for first packet
|
||||||
|
// high sequence number will not be set
|
||||||
|
bool first = frame->GetHighSeqNum() == -1;
|
||||||
bufferReturn = frame->InsertPacket(packet, nowMs);
|
bufferReturn = frame->InsertPacket(packet, nowMs);
|
||||||
ret = bufferReturn;
|
ret = bufferReturn;
|
||||||
|
|
||||||
@ -1700,8 +1703,7 @@ VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
|
|||||||
|
|
||||||
// Insert each frame once on the arrival of the first packet
|
// Insert each frame once on the arrival of the first packet
|
||||||
// belonging to that frame (media or empty)
|
// belonging to that frame (media or empty)
|
||||||
if (state == kStateEmpty &&
|
if (state == kStateEmpty && first)
|
||||||
frame->GetHighSeqNum() == packet.seqNum)
|
|
||||||
{
|
{
|
||||||
ret = kFirstPacket;
|
ret = kFirstPacket;
|
||||||
_frameBuffersTSOrder.Insert(frame);
|
_frameBuffersTSOrder.Insert(frame);
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "internal_defines.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMSessionInfo::VCMSessionInfo():
|
VCMSessionInfo::VCMSessionInfo():
|
||||||
@ -52,11 +54,7 @@ VCMSessionInfo::GetLowSeqNum() const
|
|||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VCMSessionInfo::GetHighSeqNum() const
|
VCMSessionInfo::GetHighSeqNum() const
|
||||||
{
|
{
|
||||||
if (_emptySeqNumHigh != -1)
|
return VCM_MAX(_emptySeqNumHigh, _highSeqNum);
|
||||||
{
|
|
||||||
return _emptySeqNumHigh;
|
|
||||||
}
|
|
||||||
return _highSeqNum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1895,7 +1895,7 @@ int JitterBufferTest(CmdArgs& args)
|
|||||||
packet.seqNum = seqNum;
|
packet.seqNum = seqNum;
|
||||||
packet.timestamp = timeStamp;
|
packet.timestamp = timeStamp;
|
||||||
packet.frameType = kFrameEmpty;
|
packet.frameType = kFrameEmpty;
|
||||||
TEST(kFirstPacket == jb.InsertPacket(frameIn, packet));
|
TEST(kIncomplete == jb.InsertPacket(frameIn, packet));
|
||||||
// now insert the first data packet
|
// now insert the first data packet
|
||||||
seqNum = 1;
|
seqNum = 1;
|
||||||
packet.isFirstPacket = true;
|
packet.isFirstPacket = true;
|
||||||
@ -1955,6 +1955,32 @@ int JitterBufferTest(CmdArgs& args)
|
|||||||
TEST(frameIn != 0);
|
TEST(frameIn != 0);
|
||||||
|
|
||||||
jb.SetNackMode(kNoNack);
|
jb.SetNackMode(kNoNack);
|
||||||
|
jb.Flush();
|
||||||
|
|
||||||
|
// Testing that 1 empty packet inserted last will not be set for decoding
|
||||||
|
seqNum = 3;
|
||||||
|
// Insert one empty packet per frame, should never return the last timestamp
|
||||||
|
// inserted. Only return empty frames in the presence of subsequent frames.
|
||||||
|
maxSize = 1000;
|
||||||
|
for (int i = 0; i < maxSize + 10; i++)
|
||||||
|
{
|
||||||
|
timeStamp += 33 * 90;
|
||||||
|
seqNum++;
|
||||||
|
packet.isFirstPacket = false;
|
||||||
|
packet.markerBit = false;
|
||||||
|
packet.seqNum = seqNum;
|
||||||
|
packet.timestamp = timeStamp;
|
||||||
|
packet.frameType = kFrameEmpty;
|
||||||
|
testFrame = jb.GetFrameForDecoding();
|
||||||
|
// timestamp should bever be the last TS inserted
|
||||||
|
if (testFrame != NULL)
|
||||||
|
{
|
||||||
|
TEST(testFrame->TimeStamp() < timeStamp);
|
||||||
|
printf("Not null TS = %d\n",testFrame->TimeStamp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jb.Flush();
|
||||||
|
|
||||||
|
|
||||||
// printf(DONE testing inserting empty packets to the JB)
|
// printf(DONE testing inserting empty packets to the JB)
|
||||||
|
Loading…
Reference in New Issue
Block a user