[Android] AWindow: check if surfacetexture already exists
Alexandre Janniaux
git at videolan.org
Tue Feb 23 05:36:08 UTC 2021
vlc-android | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Fri Feb 12 12:18:31 2021 +0100| [898fddd577570862c8ee575815908e99b062a0b7] | committer: Nicolas Pomepuy
AWindow: check if surfacetexture already exists
The SurfaceTextureListener attached to the TextureView won't be
signalled if the SurfaceTexture already exists and is already bound to
the TextureView. It means that a call to attachTextureView() will never
end to the expected call to setSurface(), blocking the playback in this
situation.
Pointed-out-by: Aleksandra KrzemieĊ
Fixes #1587
> https://code.videolan.org/videolan/vlc-android/commit/898fddd577570862c8ee575815908e99b062a0b7
---
libvlc/src/org/videolan/libvlc/AWindow.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libvlc/src/org/videolan/libvlc/AWindow.java b/libvlc/src/org/videolan/libvlc/AWindow.java
index 00cb3f0db..d8260cc9f 100644
--- a/libvlc/src/org/videolan/libvlc/AWindow.java
+++ b/libvlc/src/org/videolan/libvlc/AWindow.java
@@ -96,6 +96,14 @@ public class AWindow implements IVLCVout {
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void attachTextureView() {
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
+
+ /* The SurfaceTexture might be already available, in which case
+ * the listener won't be signalled. Check the existence right after
+ * attaching the listener and call it manually in this case. */
+ SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture();
+ if (surfaceTexture != null)
+ mSurfaceTextureListener.onSurfaceTextureAvailable(surfaceTexture,
+ mTextureView.getWidth(), mTextureView.getHeight());
}
private void attachSurface() {
More information about the Android
mailing list