Move frame swapping logic to frame.c

Expose frames_offer_decoded_frame() and frames_consume_rendered_frame()
so that callers are not exposed to frame swapping (between the decoding
and rendering frames) details.
This commit is contained in:
Romain Vimont
2018-02-08 19:23:24 +01:00
parent 0d7f050389
commit 629c296207
4 changed files with 58 additions and 27 deletions

View File

@@ -48,14 +48,7 @@ static void count_frame(void) {
static SDL_bool handle_new_frame(void) {
mutex_lock(frames.mutex);
AVFrame *frame = frames.rendering_frame;
frames.rendering_frame_consumed = SDL_TRUE;
#ifndef SKIP_FRAMES
// if SKIP_FRAMES is disabled, then notify the decoder the current frame is
// consumed, so that it may push a new one
cond_signal(frames.rendering_frame_consumed_cond);
#endif
const AVFrame *frame = frames_consume_rendered_frame(&frames);
if (!screen_update(&screen, frame)){
mutex_unlock(frames.mutex);
return SDL_FALSE;