[Android] BrowserProvider: Safely send media to channel
Geoffrey Métais
git at videolan.org
Fri Aug 9 13:32:13 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 9 13:31:31 2019 +0200| [bd91edb96f7b5c2dcb46070a9672c599c0edfcef] | committer: Geoffrey Métais
BrowserProvider: Safely send media to channel
> https://code.videolan.org/videolan/vlc-android/commit/bd91edb96f7b5c2dcb46070a9672c599c0edfcef
---
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