From 1b925d802460069d07cd150e9c5d2868a3db6ea4 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Mon, 5 Sep 2011 21:52:18 +0000 Subject: emotion/generic: Fix frame dropping. Move the frame drop counter to the shared memory object, so the player can check its value and not send new frames if we didn't "consume" the previous one. Also move the triple buffering pointer changing to the display function, so it will only lock once when accessing the critical region. SVN revision: 63220 --- src/vlc/emotion_generic_vlc.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/vlc/emotion_generic_vlc.c b/src/vlc/emotion_generic_vlc.c index b3e1eb1..dfa0962 100644 --- a/src/vlc/emotion_generic_vlc.c +++ b/src/vlc/emotion_generic_vlc.c @@ -253,17 +253,6 @@ _lock(void *data, void **pixels) static void _unlock(void *data, void *id, void *const *pixels) { - struct _App *app = data; - - if (!app->playing) - return; - - sem_wait(&app->vs->lock); - app->vs->frame.last = app->vs->frame.player; - app->vs->frame.player = app->vs->frame.next; - app->vs->frame.next = app->vs->frame.last; - - sem_post(&app->vs->lock); } static void @@ -273,7 +262,13 @@ _display(void *data, void *id) if (!app->playing) return; - _send_cmd(app, EM_RESULT_FRAME_NEW); + sem_wait(&app->vs->lock); + app->vs->frame.last = app->vs->frame.player; + app->vs->frame.player = app->vs->frame.next; + app->vs->frame.next = app->vs->frame.last; + if (!app->vs->frame_drop++) + _send_cmd(app, EM_RESULT_FRAME_NEW); + sem_post(&app->vs->lock); } static void * -- cgit v1.2.1