[Android] AudioService: expand only when the media is fully parsed

Edward Wang git at videolan.org
Thu Jul 10 17:25:43 CEST 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jul 10 11:09:56 2014 -0400| [ad366ab1f14898836967a4cd0da0fb5a3573028f] | committer: Edward Wang

AudioService: expand only when the media is fully parsed

Reduce unnecessary calls to LibVLC.expand(), since otherwise the subitems won't be available anyway.

This also fixes a bug where opening a playlist caused the contents to be imported twice due to extraneous expansion.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ad366ab1f14898836967a4cd0da0fb5a3573028f
---

 vlc-android/src/org/videolan/vlc/audio/AudioService.java |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index c5adb11..474b3e1 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -466,7 +466,7 @@ public class AudioService extends Service {
                     Log.i(TAG, "MediaPlayerEndReached");
                     service.executeUpdate();
                     service.executeUpdateProgress();
-                    service.determinePrevAndNextIndices();
+                    service.determinePrevAndNextIndices(true);
                     service.next();
                     if (service.mWakeLock.isHeld())
                         service.mWakeLock.release();
@@ -797,7 +797,11 @@ public class AudioService extends Service {
     }
 
     private void determinePrevAndNextIndices() {
-        mNextIndex = mLibVLC.expand();
+        determinePrevAndNextIndices(false);
+    }
+
+    private void determinePrevAndNextIndices(boolean expand) {
+        mNextIndex = expand ? mLibVLC.expand() : -1;
         mPrevIndex = -1;
 
         if (mNextIndex == -1) {



More information about the Android mailing list