Fixed a Flush/Start initialization bug in the jitter buffer. Also cleaned

up "Nack estimate".
Review URL: http://webrtc-codereview.appspot.com/32009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@78 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
holmer@google.com
2011-06-15 07:37:08 +00:00
parent 2204835d4d
commit 51f2453d98
3 changed files with 34 additions and 43 deletions

View File

@@ -213,7 +213,9 @@ VCMJitterBuffer::Start()
_waitingForCompletion.latestPacketTime = -1;
_missingMarkerBits = false;
_firstPacket = true;
_NACKSeqNumLength = 0;
_rttMs = 0;
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId), "JB(0x%x): Jitter buffer: start", this);
}
@@ -286,6 +288,8 @@ VCMJitterBuffer::FlushInternal()
_missingMarkerBits = false;
_firstPacket = true;
_NACKSeqNumLength = 0;
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
"JB(0x%x): Jitter buffer: flush", this);
}
@@ -846,17 +850,20 @@ VCMJitterBuffer::GetCompleteFrameForDecoding(WebRtc_UWord32 maxWaitTimeMS)
}
// we have a frame
// store seqnum
// store seqnum
_lastDecodedSeqNum = oldestFrame->GetHighSeqNum();
// store current timestamp
_lastDecodedTimeStamp = oldestFrame->TimeStamp();
// Update jitter estimate
const bool retransmitted = (oldestFrame->GetNackCount() > 0);
_jitterEstimate.UpdateNackEstimate(retransmitted);
// Ignore retransmitted frames also ignore empty frames.
if (!retransmitted && oldestFrame->Length() > 0)
if (retransmitted)
{
_jitterEstimate.FrameNacked();
}
else if (oldestFrame->Length() > 0)
{
// Ignore retransmitted and empty frames.
UpdateJitterAndDelayEstimates(*oldestFrame, false);
}
@@ -1061,10 +1068,13 @@ VCMJitterBuffer::GetFrameForDecoding()
// This frame shouldn't have been retransmitted, but if we recently
// turned off NACK this might still happen.
const bool retransmitted = (oldestFrame->GetNackCount() > 0);
_jitterEstimate.UpdateNackEstimate(retransmitted);
// Ignore retransmitted frames also ignore empty frames.
if (!retransmitted && oldestFrame->Length() > 0)
if (retransmitted)
{
_jitterEstimate.FrameNacked();
}
else if (oldestFrame->Length() > 0)
{
// Ignore retransmitted and empty frames.
// Update with the previous incomplete frame first
if (_waitingForCompletion.latestPacketTime >= 0)
{
@@ -1137,10 +1147,13 @@ VCMJitterBuffer::GetFrameForDecodingNACK()
// Update jitter estimate
const bool retransmitted = (oldestFrame->GetNackCount() > 0);
_jitterEstimate.UpdateNackEstimate(retransmitted);
// Ignore retransmitted frames also ignore empty frames.
if (!retransmitted && oldestFrame->Length() > 0)
if (retransmitted)
{
_jitterEstimate.FrameNacked();
}
else if (oldestFrame->Length() > 0)
{
// Ignore retransmitted and empty frames.
UpdateJitterAndDelayEstimates(*oldestFrame, false);
}