diff options
author | stefan@webrtc.org <stefan@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-04-29 16:41:30 +0000 |
---|---|---|
committer | stefan@webrtc.org <stefan@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-04-29 16:41:30 +0000 |
commit | c12e655e176f5a6f7892625d783661634cb7a891 (patch) | |
tree | 266a49820e4ebf51dbd747c5bbfe585edb68b17a | |
parent | b8f1cf333feac2bb40517d8c6c3e3b84f66177f5 (diff) | |
download | webrtc-c12e655e176f5a6f7892625d783661634cb7a891.tar.gz |
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/webrtc@3914 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r-- | modules/video_coding/main/source/receiver.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/video_coding/main/source/receiver.cc b/modules/video_coding/main/source/receiver.cc index 65d7a683..ae0f1cec 100644 --- a/modules/video_coding/main/source/receiver.cc +++ b/modules/video_coding/main/source/receiver.cc @@ -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. |