[Android] BrowserProvider: Safely send media to channel
Geoffrey Métais
git at videolan.org
Mon Aug 12 13:44:14 CEST 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 9 13:31:31 2019 +0200| [bba0cc0755a4eea2952a5a7882a6072b89a72cff] | committer: Geoffrey Métais
BrowserProvider: Safely send media to channel
(cherry picked from commit bd91edb96f7b5c2dcb46070a9672c599c0edfcef)
> https://code.videolan.org/videolan/vlc-android/commit/bba0cc0755a4eea2952a5a7882a6072b89a72cff
---
vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index 3636f31a3..760b5eb43 100644
--- a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -227,9 +227,11 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
override fun onMediaAdded(index: Int, media: Media) {
if (!browserChannel.isClosedForSend) {
media.retain()
- browserChannel.offer(media)
+ if (!browserChannel.isClosedForSend) browserChannel.offer(media)
+ else media.release()
}
}
+
override fun onBrowseEnd() { if (!browserChannel.isClosedForSend) browserChannel.close() }
override fun onMediaRemoved(index: Int, media: Media){}
More information about the Android
mailing list