From 5151172a936293e7d9532351aeea819b7ffef2d3 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sat, 28 Oct 2017 20:24:53 +0200 Subject: [PATCH] movieplayer: fix updateposition loop --- src/gui/movieplayer.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 54313ddf9..aec9437dd 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2556,14 +2556,20 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int /*position*/) void CMoviePlayerGui::UpdatePosition() { - while (!playback->GetPosition(position, duration)) { - if (duration > 100) - file_prozent = (unsigned char) (position / (duration / 100)); - FileTimeOSD->update(position, duration); -#ifdef DEBUG - printf("CMoviePlayerGui::%s: spd %d pos %d/%d (%d, %d%%)\n", __func__, speed, position, duration, duration-position, file_prozent); -#endif + int cnt = 0; + do + { + usleep(10000); + cnt++; } + while ((!playback->GetPosition(position, duration)) || (cnt <= 5)); + + if (duration > 100) + file_prozent = (unsigned char) (position / (duration / 100)); + FileTimeOSD->update(position, duration); +#ifdef DEBUG + printf("CMoviePlayerGui::%s: spd %d pos %d/%d (%d, %d%%)\n", __func__, speed, position, duration, duration-position, file_prozent); +#endif } void CMoviePlayerGui::showHelp()