Fix two issues where we might end up busy looping in decoder_render mode.

This happens if
- Next frame is far into the future (> 200 ms).
- Next frame is ready for decode/render but incomplete.

BUG=1696
TESTS=trybots

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3914 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2013-04-29 16:41:30 +00:00
parent b0061f94b2
commit 5b7120c81b

View File

@ -296,15 +296,21 @@ VCMEncodedFrame* VCMReceiver::FrameForRendering(uint16_t max_wait_time_ms,
uint32_t wait_time_ms = timing_->MaxWaitingTime(
next_render_time_ms, clock_->TimeInMilliseconds());
if (max_wait_time_ms < wait_time_ms) {
// If we're not allowed to wait until the frame is supposed to be rendered
// we will have to return NULL for now.
// If we're not allowed to wait until the frame is supposed to be rendered,
// waiting as long as we're allowed to avoid busy looping, and then return
// NULL. Next call to this function might return the frame.
render_wait_event_->Wait(max_wait_time_ms);
return NULL;
}
// Wait until it's time to render.
render_wait_event_->Wait(wait_time_ms);
// Get a complete frame if possible.
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
// Note: This might cause us to wait more than a total of |max_wait_time_ms|.
// This is necessary to avoid a possible busy loop if no complete frame
// has been received.
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(
max_wait_time_ms);
if (frame == NULL) {
// Get an incomplete frame.