VCM/JB: Bug fix in ExtractAndSetDecode

BUG=1771
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1466005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4035 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org
2013-05-15 17:10:44 +00:00
parent 5add4ad09c
commit cb20a5b2d7

View File

@ -371,7 +371,7 @@ bool VCMJitterBuffer::CompleteSequenceWithNextFrame() {
// Frame not ready to be decoded.
return true;
}
if (!oldest_frame->Complete()) {
if (oldest_frame->GetState() != kStateComplete) {
return false;
}
@ -508,42 +508,41 @@ VCMEncodedFrame* VCMJitterBuffer::ExtractAndSetDecode(uint32_t timestamp) {
}
// We got the frame.
VCMFrameBuffer* frame = *it;
// Frame pulled out from jitter buffer,
// update the jitter estimate with what we currently know.
frame_list_.erase(it);
if (frame_list_.empty()) {
TRACE_EVENT_INSTANT1("webrtc", "JB::FrameListEmptied",
"type", "ExtractAndSetDecode");
}
// Frame pulled out from jitter buffer, update the jitter estimate.
const bool retransmitted = (frame->GetNackCount() > 0);
if (retransmitted) {
jitter_estimate_.FrameNacked();
} else if (frame->Length() > 0) {
// Ignore retransmitted and empty frames.
// Update with the previous incomplete frame first
if (waiting_for_completion_.latest_packet_time >= 0) {
UpdateJitterEstimate(waiting_for_completion_, true);
}
// Then wait for this one to get complete
waiting_for_completion_.frame_size = frame->Length();
waiting_for_completion_.latest_packet_time =
frame->LatestPacketTimeMs();
waiting_for_completion_.timestamp = frame->TimeStamp();
if (frame->GetState() == kStateComplete) {
UpdateJitterEstimate(*frame, false);
} else {
// Wait for this one to get complete.
waiting_for_completion_.frame_size = frame->Length();
waiting_for_completion_.latest_packet_time =
frame->LatestPacketTimeMs();
waiting_for_completion_.timestamp = frame->TimeStamp();
}
}
frame_list_.erase(frame_list_.begin());
if (frame_list_.empty()) {
TRACE_EVENT_INSTANT1("webrtc", "JB::FrameListEmptied",
"type", "MaybeGetIncompleteFrameForDecoding");
}
// Look for previous frame loss.
VerifyAndSetPreviousFrameLost(frame);
// The state must be changed to decoding before cleaning up zero sized
// frames to avoid empty frames being cleaned up and then given to the
// decoder.
// Set as decoding. Propagates the missing_frame bit.
// decoder. Propagates the missing_frame bit.
frame->SetState(kStateDecoding);
num_not_decodable_packets_ += frame->NotDecodablePackets();
// We have a frame - update decoded state with frame info.
// We have a frame - update the last decoded state and nack list.
last_decoded_state_.SetState(frame);
DropPacketsFromNackList(last_decoded_state_.sequence_num());
return frame;