summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2011-09-05 21:52:18 +0000
committerRafael Antognolli <antognolli@gmail.com>2011-09-05 21:52:18 +0000
commit4be7a99b942567194418b3b372abc0cdf35d32e9 (patch)
treedb1afd00df328ed82fd86d1ff71a9f0a5c572ba3 /legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
parent0d7da38f058933fb46dcedfa4e8751d0b5f7b40e (diff)
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
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
index b3e1eb1d1c..dfa0962132 100644
--- a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
+++ b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
@@ -253,17 +253,6 @@ _lock(void *data, void **pixels)
253static void 253static void
254_unlock(void *data, void *id, void *const *pixels) 254_unlock(void *data, void *id, void *const *pixels)
255{ 255{
256 struct _App *app = data;
257
258 if (!app->playing)
259 return;
260
261 sem_wait(&app->vs->lock);
262 app->vs->frame.last = app->vs->frame.player;
263 app->vs->frame.player = app->vs->frame.next;
264 app->vs->frame.next = app->vs->frame.last;
265
266 sem_post(&app->vs->lock);
267} 256}
268 257
269static void 258static void
@@ -273,7 +262,13 @@ _display(void *data, void *id)
273 if (!app->playing) 262 if (!app->playing)
274 return; 263 return;
275 264
276 _send_cmd(app, EM_RESULT_FRAME_NEW); 265 sem_wait(&app->vs->lock);
266 app->vs->frame.last = app->vs->frame.player;
267 app->vs->frame.player = app->vs->frame.next;
268 app->vs->frame.next = app->vs->frame.last;
269 if (!app->vs->frame_drop++)
270 _send_cmd(app, EM_RESULT_FRAME_NEW);
271 sem_post(&app->vs->lock);
277} 272}
278 273
279static void * 274static void *