<html><head></head><body>Right, patch is OK.<br>
<br>
May I ask why you prefer pre increment though?<br><br><div class="gmail_quote"><br>
Felix Abecassis <felix.abecassis@gmail.com> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">No.<br /><br /><a href="http://stackoverflow.com/questions/4706199/post-increment-and-pre-increment-within-a-for-loop-produce-same-output">http://stackoverflow.com/questions/4706199/post-increment-and-pre-increment-within-a-for-loop-produce-same-output</a><span class="sewivssibql5yy4"></span><span class="sewivssibql5yy4"></span></div>

<div class="gmail_extra"><br /><br /><div class="gmail_quote">2013/11/27 Rafaël Carré <span dir="ltr"><<a href="mailto:rafael.carre@gmail.com" target="_blank">rafael.carre@gmail.com</a>></span><br /><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>Sorry but with ++i compared to i++ that makes 99 attempts no?<br /><br /><div class="gmail_quote"><div class="im"><br />
Felix Abecassis <<a href="mailto:felix.abecassis@gmail.com" target="_blank">felix.abecassis@gmail.com</a>> a écrit :</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<pre>Avoid waiting unnecessarily when the media player reaches exactly THUMBNAIL_POSITION. However we must now wait until libvlc updates the position before polling with libvlc_media_player_get_position().<div><div class="h5">

<br />---<br />vlc-android/jni/thumbnailer.c | 10 +++++-----<br />1 file changed, 5 insertions(+), 5 deletions(-)<br /><br />diff --git a/vlc-android/jni/thumbnailer.c b/vlc-android/jni/thumbnailer.c<br />index 2d41a59..1f65ed7 100644<br />

--- a/vlc-android/jni/thumbnailer.c<br />+++ b/vlc-android/jni/thumbnailer.c<br />@@ -263,12 +263,12 @@ jbyteArray Java_org_videolan_libvlc_LibVLC_getThumbnail(JNIEnv *env, jobject thi<br />libvlc_media_player_play(mp);<br />libvlc_media_player_set_position(mp, THUMBNAIL_POSITION);<br />

<br />-    int loops = 100;<br />-    for (;;) {<br />-        float pos = libvlc_media_player_get_position(mp);<br />-        if (pos > THUMBNAIL_POSITION || !loops--)<br />+    const int wait_time = 50000;<br />+    const int max_attempts =
100;<br />+    for (int i = 0; i < max_attempts; ++i) {<br />+        if (libvlc_media_player_is_playing(mp) && libvlc_media_player_get_position(mp) >= THUMBNAIL_POSITION)<br />break;<br />-        usleep(50000);<br />

+        usleep(wait_time);<br />}<br /><br />/* Wait for the thumbnail to be generated. */</div></div></pre></blockquote></div><br />
-- <br /><div class="im">
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.</div></div><br />_______________________________________________<br />
Android mailing list<br />
<a href="mailto:Android@videolan.org">Android@videolan.org</a><br />
<a href="https://mailman.videolan.org/listinfo/android" target="_blank">https://mailman.videolan.org/listinfo/android</a><br />
<br /></blockquote></div><br /><br clear="all" /></div></blockquote></div><br>
-- <br>
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.</body></html>