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:
@@ -296,15 +296,21 @@ VCMEncodedFrame* VCMReceiver::FrameForRendering(uint16_t max_wait_time_ms,
|
|||||||
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
||||||
next_render_time_ms, clock_->TimeInMilliseconds());
|
next_render_time_ms, clock_->TimeInMilliseconds());
|
||||||
if (max_wait_time_ms < wait_time_ms) {
|
if (max_wait_time_ms < wait_time_ms) {
|
||||||
// If we're not allowed to wait until the frame is supposed to be rendered
|
// If we're not allowed to wait until the frame is supposed to be rendered,
|
||||||
// we will have to return NULL for now.
|
// 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;
|
return NULL;
|
||||||
}
|
}
|
||||||
// Wait until it's time to render.
|
// Wait until it's time to render.
|
||||||
render_wait_event_->Wait(wait_time_ms);
|
render_wait_event_->Wait(wait_time_ms);
|
||||||
|
|
||||||
// Get a complete frame if possible.
|
// 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) {
|
if (frame == NULL) {
|
||||||
// Get an incomplete frame.
|
// Get an incomplete frame.
|
||||||
|
|||||||
Reference in New Issue
Block a user