video_coding: Updating seq number for old zero size packets. Updating function name to reflect zero size packets and not empty packets.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1307 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2011-12-29 17:37:39 +00:00
parent 70adcd46b2
commit bed34a341a
3 changed files with 12 additions and 6 deletions

View File

@ -94,11 +94,10 @@ void VCMDecodingState::SetStateOneBack(const VCMFrameBuffer* frame) {
init_ = false;
}
void VCMDecodingState::UpdateEmptyPacket(const VCMPacket* packet) {
void VCMDecodingState::UpdateZeroSizePacket(const VCMPacket* packet) {
assert(packet != NULL);
if (packet->sizeBytes == 0 && packet->timestamp == time_stamp_) {
// Empty packet (sizeBytes = 0), make sure we update the last
// decoded sequence number.
// Zero size packet - make sure we update the last decoded sequence number.
sequence_num_ = LatestSequenceNumber(packet->seqNum, sequence_num_, NULL);
}
}

View File

@ -34,8 +34,8 @@ class VCMDecodingState {
// Set the decoding state one frame back.
void SetStateOneBack(const VCMFrameBuffer* frame);
// Update the sequence number if the timestamp matches current state and the
// packet is empty.
void UpdateEmptyPacket(const VCMPacket* packet);
// packet is of zero size.
void UpdateZeroSizePacket(const VCMPacket* packet);
void SetSeqNum(uint16_t new_seq_num);
void Reset();
uint32_t time_stamp() const;

View File

@ -445,6 +445,13 @@ VCMJitterBuffer::GetFrame(const VCMPacket& packet, VCMEncodedFrame*& frame)
_discardedPackets++;
_numConsecutiveOldPackets++;
}
else
{
// Update last decoded sequence number if packet belongs to a zero
// size frame with a timestamp equal to the last decoded timestamp.
_lastDecodedState.UpdateZeroSizePacket(&packet);
}
if (_numConsecutiveOldPackets > kMaxConsecutiveOldPackets)
{
FlushInternal();
@ -1563,7 +1570,7 @@ VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
if (frame != NULL)
{
VCMFrameBufferStateEnum state = frame->GetState();
_lastDecodedState.UpdateEmptyPacket(&packet);
_lastDecodedState.UpdateZeroSizePacket(&packet);
// Insert packet
// Check for first packet
// High sequence number will be -1 if neither an empty packet nor