[Android] Save current audio&spu tracks in memory

Geoffrey Métais git at videolan.org
Mon Mar 20 14:54:47 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 20 14:33:38 2017 +0100| [6ab4afa365066b4f7cfb9ec753d48e3fdef50bf7] | committer: Geoffrey Métais

Save current audio&spu tracks in memory

> https://code.videolan.org/videolan/vlc-android/commit/6ab4afa365066b4f7cfb9ec753d48e3fdef50bf7
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java      | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index ba36940..e65ce2a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -258,6 +258,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private long mSpuDelay = 0;
     private long mAudioDelay = 0;
     private boolean mRateHasChanged = false;
+    private int mCurrentAudioTrack = -2, mCurrentSpuTrack = -2;
 
     private boolean mIsLocked = false;
     /* -1 is a valid track (Disable) */
@@ -867,6 +868,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         else if (mBtReceiver != null && (mAudioManager.isBluetoothA2dpOn() || mAudioManager.isBluetoothScoOn()))
             toggleBtDelay(true);
         mService.setSpuDelay(mSpuDelay);
+        if (mCurrentSpuTrack != -2)
+            mService.setSpuTrack(mCurrentSpuTrack);
+        if (mCurrentAudioTrack != -2)
+            mService.setAudioTrack(mCurrentAudioTrack);
     }
 
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@@ -875,6 +880,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             return;
 
         mWasPaused = !mService.isPlaying();
+        if (!isFinishing()) {
+            mCurrentAudioTrack = mService.getAudioTrack();
+            mCurrentSpuTrack = mService.getSpuTrack();
+        }
 
         if (mMute)
             mute(false);



More information about the Android mailing list