Reverts r807 and fixes the real issue in the VCM.

This fixes an issue in the VCM where we don't wait for a packet to arrive
if the jitter buffer is empty. This also fixes an issue where an old
packet can trigger a packet event signal for a future frame.

BUG=
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@814 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2011-10-25 11:52:48 +00:00
parent bdb55c806f
commit d855c1a4e8
4 changed files with 22 additions and 25 deletions

View File

@@ -241,38 +241,46 @@ VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
{
// How long can we wait until we must decode the next frame
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
VCMTickTime::MillisecondTimestamp());
VCMTickTime::MillisecondTimestamp());
// Try to get a complete frame from the jitter buffer
VCMEncodedFrame* frame = _jitterBuffer.GetCompleteFrameForDecoding(0);
if (frame == NULL && maxWaitTimeMs == 0 && waitTimeMs > 0)
{
// If we're not allowed to wait for frames to get complete we must calculate if
// it's time to decode, and if it's not we will just return for now.
// If we're not allowed to wait for frames to get complete we must
// calculate if it's time to decode, and if it's not we will just return
// for now.
return NULL;
}
if (frame == NULL && VCM_MIN(waitTimeMs, maxWaitTimeMs) == 0)
{
// No time to wait for a complete frame,
// check if we have an incomplete
frame = _jitterBuffer.GetFrameForDecoding();
}
if (frame == NULL)
{
// Wait for a complete frame
waitTimeMs = VCM_MIN(waitTimeMs, maxWaitTimeMs);
frame = _jitterBuffer.GetCompleteFrameForDecoding(waitTimeMs);
frame = _jitterBuffer.GetCompleteFrameForDecoding(maxWaitTimeMs);
}
if (frame == NULL)
{
// Get an incomplete frame
if (_timing.MaxWaitingTime(nextRenderTimeMs, VCMTickTime::MillisecondTimestamp()) > 0)
if (_timing.MaxWaitingTime(nextRenderTimeMs,
VCMTickTime::MillisecondTimestamp()) > 0)
{
// Still time to wait for a complete frame
return NULL;
}
// No time left to wait, we must decode this frame now.
const bool dualReceiverEnabledAndPassive = dualReceiver != NULL &&
dualReceiver->State() == kPassive &&
dualReceiver->NackMode() == kNackInfinite;
if (dualReceiverEnabledAndPassive && !_jitterBuffer.CompleteSequenceWithNextFrame())
const bool dualReceiverEnabledAndPassive = (dualReceiver != NULL &&
dualReceiver->State() == kPassive &&
dualReceiver->NackMode() == kNackInfinite);
if (dualReceiverEnabledAndPassive &&
!_jitterBuffer.CompleteSequenceWithNextFrame())
{
// Jitter buffer state might get corrupt with this frame.
dualReceiver->CopyJitterBufferStateFromReceiver(*this);