[Android] MediaParsing: Fix channel closed too early

Geoffrey Métais git at videolan.org
Mon Dec 23 09:24:02 CET 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 23 09:09:46 2019 +0100| [6366db2a3cd2b385f275d173bd67dfb4f8ec87ac] | committer: Geoffrey Métais

MediaParsing: Fix channel closed too early

(cherry picked from commit 93e1983d54b27e1fd5f8860e4b36dc6a8e2fb3ea)

> https://code.videolan.org/videolan/vlc-android/commit/6366db2a3cd2b385f275d173bd67dfb4f8ec87ac
---

 .../src/org/videolan/vlc/MediaParsingService.kt        | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index eb3ea606b..81f7ca0b4 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -423,16 +423,16 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
             is Init -> {
                 if (medialibrary.isInitiated) {
                     exitCommand()
-                    return at actor
+                } else {
+                    val context = this at MediaParsingService
+                    var shouldInit = !dbExists()
+                    val initCode = medialibrary.init(context)
+                    if (initCode != AbstractMedialibrary.ML_INIT_ALREADY_INITIALIZED) {
+                        shouldInit = shouldInit or (initCode == AbstractMedialibrary.ML_INIT_DB_RESET) or (initCode == AbstractMedialibrary.ML_INIT_DB_CORRUPTED)
+                        if (initCode != AbstractMedialibrary.ML_INIT_FAILED) initMedialib(action.parse, context, shouldInit, action.upgrade)
+                        else exitCommand()
+                    } else exitCommand()
                 }
-                val context = this at MediaParsingService
-                var shouldInit = !dbExists()
-                val initCode = medialibrary.init(context)
-                if (initCode != AbstractMedialibrary.ML_INIT_ALREADY_INITIALIZED) {
-                    shouldInit = shouldInit or (initCode == AbstractMedialibrary.ML_INIT_DB_RESET) or (initCode == AbstractMedialibrary.ML_INIT_DB_CORRUPTED)
-                    if (initCode != AbstractMedialibrary.ML_INIT_FAILED) initMedialib(action.parse, context, shouldInit, action.upgrade)
-                    else exitCommand()
-                } else  exitCommand()
             }
             is StartScan -> {
                 scanActivated = true



More information about the Android mailing list