[Android] Player: immediately release media

Geoffrey Métais git at videolan.org
Mon Jun 11 11:57:26 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 11 11:48:58 2018 +0200| [7a9198a8b0727176a7aa3487c2149ce4fe4f838d] | committer: Geoffrey Métais

Player: immediately release media

> https://code.videolan.org/videolan/vlc-android/commit/7a9198a8b0727176a7aa3487c2149ce4fe4f838d
---

 vlc-android/src/org/videolan/vlc/media/PlayerController.kt | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
index a08e6d7d7..1538f03b0 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlayerController.kt
@@ -192,14 +192,15 @@ class PlayerController : IVLCVout.Callback, MediaPlayer.EventListener {
     }
 
     fun setSlaves(media: Media, mw: MediaWrapper) = uiJob(false) {
+        val slaves = mw.slaves
+        slaves?.let { for (slave in it) media.addSlave(slave) }
+        media.release()
         val list = withContext(VLCIO) {
-            mw.slaves?.let {
-                for (slave in it) media.addSlave(slave)
-                MediaDatabase.getInstance().saveSlaves(mw)
+            MediaDatabase.getInstance().run {
+                if (slaves != null) saveSlaves(mw)
+                getSlaves(mw.location)
             }
-            MediaDatabase.getInstance().getSlaves(mw.location)
         }
-        media.release()
         for (slave in list) mediaplayer.addSlave(slave.type, Uri.parse(slave.uri), false)
     }
 



More information about the Android mailing list