[Android] Prevent an IllegalStateException when the MediaDiscoverer is already released
Nicolas Pomepuy
git at videolan.org
Fri Oct 15 08:52:20 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Oct 13 08:38:44 2021 +0200| [7c15f045145a8e8ca3a35f9876601bd39937d8fc] | committer: Nicolas Pomepuy
Prevent an IllegalStateException when the MediaDiscoverer is already released
> https://code.videolan.org/videolan/vlc-android/commit/7c15f045145a8e8ca3a35f9876601bd39937d8fc
---
libvlc/src/org/videolan/libvlc/util/MediaBrowser.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
index 4cf4ef6bd..f76d5dfe3 100644
--- a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
+++ b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
@@ -22,16 +22,17 @@ package org.videolan.libvlc.util;
import android.net.Uri;
import android.os.Handler;
-import androidx.annotation.MainThread;
import android.util.Log;
+import androidx.annotation.MainThread;
+
import org.videolan.libvlc.FactoryManager;
-import org.videolan.libvlc.interfaces.IMediaFactory;
+import org.videolan.libvlc.MediaDiscoverer;
+import org.videolan.libvlc.MediaList;
import org.videolan.libvlc.interfaces.ILibVLC;
import org.videolan.libvlc.interfaces.IMedia;
-import org.videolan.libvlc.MediaDiscoverer;
+import org.videolan.libvlc.interfaces.IMediaFactory;
import org.videolan.libvlc.interfaces.IMediaList;
-import org.videolan.libvlc.MediaList;
import java.util.ArrayList;
@@ -154,7 +155,7 @@ public class MediaBrowser {
final MediaList ml = md.getMediaList();
ml.setEventListener(mDiscovererMediaListEventListener, mHandler);
ml.release();
- md.start();
+ if (!md.isReleased()) md.start();
}
/**
More information about the Android
mailing list