<html><head></head><body>Sorry but with ++i compared to i++ that makes 99 attempts no?<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;">
<pre class="k9mail">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().<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. */</pre></blockquote></div><br>
-- <br>
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.</body></html>