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; init_ = false;
} }
void VCMDecodingState::UpdateEmptyPacket(const VCMPacket* packet) { void VCMDecodingState::UpdateZeroSizePacket(const VCMPacket* packet) {
assert(packet != NULL); assert(packet != NULL);
if (packet->sizeBytes == 0 && packet->timestamp == time_stamp_) { if (packet->sizeBytes == 0 && packet->timestamp == time_stamp_) {
// Empty packet (sizeBytes = 0), make sure we update the last // Zero size packet - make sure we update the last decoded sequence number.
// decoded sequence number.
sequence_num_ = LatestSequenceNumber(packet->seqNum, sequence_num_, NULL); sequence_num_ = LatestSequenceNumber(packet->seqNum, sequence_num_, NULL);
} }
} }

View File

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

View File

@ -445,6 +445,13 @@ VCMJitterBuffer::GetFrame(const VCMPacket& packet, VCMEncodedFrame*& frame)
_discardedPackets++; _discardedPackets++;
_numConsecutiveOldPackets++; _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) if (_numConsecutiveOldPackets > kMaxConsecutiveOldPackets)
{ {
FlushInternal(); FlushInternal();
@ -1563,7 +1570,7 @@ VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
if (frame != NULL) if (frame != NULL)
{ {
VCMFrameBufferStateEnum state = frame->GetState(); VCMFrameBufferStateEnum state = frame->GetState();
_lastDecodedState.UpdateEmptyPacket(&packet); _lastDecodedState.UpdateZeroSizePacket(&packet);
// Insert packet // Insert packet
// Check for first packet // Check for first packet
// High sequence number will be -1 if neither an empty packet nor // High sequence number will be -1 if neither an empty packet nor