[Android] PlaybackService: fix same song being played if list size is 0

Thomas Guillem git at videolan.org
Thu Oct 15 10:29:37 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 15 10:28:26 2015 +0200| [fc2f2f3e85a66395dc58c957f2870c92a02fa7dc] | committer: Thomas Guillem

PlaybackService: fix same song being played if list size is 0

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

 .../src/org/videolan/vlc/PlaybackService.java      |   25 ++++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 39cdea6..87c6e32 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1135,19 +1135,18 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
     @MainThread
     public void next() {
         int size = mMediaList.size();
-        if (size > 1) {
-            mPrevious.push(mCurrentIndex);
-            mCurrentIndex = mNextIndex;
-            Log.d(TAG, "setting current to "+mCurrentIndex);
-            if (size == 0 || mCurrentIndex < 0 || mCurrentIndex >= size) {
-                if (mCurrentIndex < 0)
-                    saveCurrentMedia();
-                Log.w(TAG, "Warning: invalid next index, aborted !");
-                stop();
-                return;
-            }
-        } else
-            setPosition(0f);
+
+        mPrevious.push(mCurrentIndex);
+        mCurrentIndex = mNextIndex;
+        Log.d(TAG, "setting current to "+mCurrentIndex);
+        if (size == 0 || mCurrentIndex < 0 || mCurrentIndex >= size) {
+            if (mCurrentIndex < 0)
+                saveCurrentMedia();
+            Log.w(TAG, "Warning: invalid next index, aborted !");
+            stop();
+            return;
+        }
+
         playIndex(mCurrentIndex, 0);
         onMediaChanged();
     }



More information about the Android mailing list