diff options
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 9d9b20b..e92e826 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -827,20 +827,22 @@ bool BootAnimation::movie() } - ALOGD("waiting for media player to complete."); - struct timespec timeout; - clock_gettime(CLOCK_REALTIME, &timeout); - timeout.tv_sec += 5; //timeout after 5s. - - pthread_mutex_lock(&mp_lock); - while (!isMPlayerCompleted) { - int err = pthread_cond_timedwait(&mp_cond, &mp_lock, &timeout); - if (err == ETIMEDOUT) { - break; + if (isMPlayerPrepared) { + ALOGD("waiting for media player to complete."); + struct timespec timeout; + clock_gettime(CLOCK_REALTIME, &timeout); + timeout.tv_sec += 5; //timeout after 5s. + + pthread_mutex_lock(&mp_lock); + while (!isMPlayerCompleted) { + int err = pthread_cond_timedwait(&mp_cond, &mp_lock, &timeout); + if (err == ETIMEDOUT) { + break; + } } + pthread_mutex_unlock(&mp_lock); + ALOGD("media player is completed."); } - pthread_mutex_unlock(&mp_lock); - ALOGD("media player is completed."); pthread_cond_destroy(&mp_cond); pthread_mutex_destroy(&mp_lock); |