[vlc-commits] android/utils: clear the surface starting Android M

Thomas Guillem git at videolan.org
Wed Oct 26 15:07:28 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 26 15:05:50 2016 +0200| [1b1e20dde21cfb2fe6d54e9189879d5a1f7c56f6] | committer: Thomas Guillem

android/utils: clear the surface starting Android M

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b1e20dde21cfb2fe6d54e9189879d5a1f7c56f6
---

 modules/video_output/android/utils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index dd2d1de..141b2ed 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -510,7 +510,11 @@ AWindowHandler_releaseANativeWindowEnv(AWindowHandler *p_awh, JNIEnv *p_env,
 
     if (p_awh->views[id].p_anw)
     {
-        if (b_clear && p_awh->anw_api.setBuffersGeometry)
+        /* Clear the surface starting Android M (anwp is NULL in that case).
+         * Don't do it earlier because MediaCodec may not be able to connect to
+         * the surface anymore. */
+        if (b_clear && p_awh->anw_api.setBuffersGeometry
+         && AWindowHandler_getANativeWindowPrivAPI(p_awh) == NULL)
         {
             /* Clear the surface by displaying a 1x1 black RGB buffer */
             ANativeWindow *p_anw = p_awh->views[id].p_anw;



More information about the vlc-commits mailing list