diff options
author | Rafael Antognolli <antognolli@gmail.com> | 2011-09-05 21:52:18 +0000 |
---|---|---|
committer | Rafael Antognolli <antognolli@gmail.com> | 2011-09-05 21:52:18 +0000 |
commit | 1b925d802460069d07cd150e9c5d2868a3db6ea4 (patch) | |
tree | b3c798cb17842d056700dd5f7924d48ca1a7429b | |
parent | e7f5540ad6c4cb8be2c301a80f45e449b6e40e25 (diff) | |
download | emotion_generic_players-1b925d802460069d07cd150e9c5d2868a3db6ea4.tar.gz |
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
-rw-r--r-- | src/vlc/emotion_generic_vlc.c | 19 |
1 files changed, 7 insertions, 12 deletions
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 * |