diff options
author | Marton Balint <cus@passwd.hu> | 2013-02-15 12:43:27 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2013-02-15 13:12:10 +0100 |
commit | 77ab702a848ab74a8a100cdd9800aa60302948bc (patch) | |
tree | 91d67049f9713ee4aaf5563e03ed105de64c6f47 /ffplay.c | |
parent | 5534d8f75e271743d954886409c39e3386e9e48d (diff) | |
download | ffmpeg-77ab702a848ab74a8a100cdd9800aa60302948bc.tar.gz |
ffplay: only display frames if there are no pending events
Otherwise events could just pile up if displaying a frame takes more time than
the duration of the frame.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -2929,21 +2929,20 @@ static void toggle_audio_display(VideoState *is) } static void refresh_loop_wait_event(VideoState *is, SDL_Event *event) { - int got_event; - double remaining_time; - do { + double remaining_time = 0.0; + SDL_PumpEvents(); + while (!SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_ALLEVENTS)) { if (!cursor_hidden && av_gettime() - cursor_last_shown > CURSOR_HIDE_DELAY) { SDL_ShowCursor(0); cursor_hidden = 1; } + if (remaining_time > 0.0) + av_usleep((int64_t)(remaining_time * 1000000.0)); remaining_time = REFRESH_RATE; if (is->show_mode != SHOW_MODE_NONE && (!is->paused || is->force_refresh)) video_refresh(is, &remaining_time); SDL_PumpEvents(); - got_event = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_ALLEVENTS); - if (!got_event) - av_usleep((int64_t)(remaining_time * 1000000.0)); - } while (!got_event); + } } /* handle an event sent by the GUI */ |