[vlc-commits] vout/android: utils: remove clear surface support
Thomas Guillem
git at videolan.org
Tue Dec 20 18:08:03 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Dec 20 17:58:56 2016 +0100| [b00d601e7295d2e4dc3954079227b8209f50e73f] | committer: Thomas Guillem
vout/android: utils: remove clear surface support
Clearing surfaces with a software renderer creates too many issues like making
the surface unusable by MediaCodec.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b00d601e7295d2e4dc3954079227b8209f50e73f
---
modules/video_output/android/display.c | 15 +++++++--------
modules/video_output/android/utils.c | 30 +++++-------------------------
modules/video_output/android/utils.h | 2 +-
modules/video_output/opengl/egl.c | 2 +-
4 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 15db383..766d7f6 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -319,15 +319,14 @@ static void SetupPictureYV12(picture_t *p_picture, uint32_t i_in_stride)
}
static void AndroidWindow_DisconnectSurface(vout_display_sys_t *sys,
- android_window *p_window,
- bool b_clear)
+ android_window *p_window)
{
if (p_window->p_surface_priv) {
sys->anwp.disconnect(p_window->p_surface_priv);
p_window->p_surface_priv = NULL;
}
if (p_window->p_surface) {
- AWindowHandler_releaseANativeWindow(sys->p_awh, p_window->id, b_clear);
+ AWindowHandler_releaseANativeWindow(sys->p_awh, p_window->id);
p_window->p_surface = NULL;
}
}
@@ -406,9 +405,9 @@ error:
}
static void AndroidWindow_Destroy(vout_display_t *vd,
- android_window *p_window, bool b_clear)
+ android_window *p_window)
{
- AndroidWindow_DisconnectSurface(vd->sys, p_window, b_clear);
+ AndroidWindow_DisconnectSurface(vd->sys, p_window);
free(p_window);
}
@@ -495,7 +494,7 @@ static int AndroidWindow_ConfigureJavaSurface(vout_display_sys_t *sys,
p_window->i_android_hal) == VLC_SUCCESS)
{
*p_java_configured = true;
- AndroidWindow_DisconnectSurface(sys, p_window, false);
+ AndroidWindow_DisconnectSurface(sys, p_window);
if (AndroidWindow_ConnectSurface(sys, p_window) != 0)
return -1;
} else
@@ -793,7 +792,7 @@ static void Close(vlc_object_t *p_this)
if (sys->pool)
picture_pool_Release(sys->pool);
if (sys->p_window)
- AndroidWindow_Destroy(vd, sys->p_window, true);
+ AndroidWindow_Destroy(vd, sys->p_window);
if (sys->p_sub_pic)
picture_Release(sys->p_sub_pic);
@@ -801,7 +800,7 @@ static void Close(vlc_object_t *p_this)
filter_DeleteBlend(sys->p_spu_blend);
free(sys->p_sub_buffer_bounds);
if (sys->p_sub_window)
- AndroidWindow_Destroy(vd, sys->p_sub_window, false);
+ AndroidWindow_Destroy(vd, sys->p_sub_window);
if (sys->embed)
vout_display_DeleteWindow(vd, sys->embed);
diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index 4ea575b..df9c9ca 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -554,30 +554,12 @@ AWindowHandler_new(vout_window_t *wnd, awh_events_t *p_events)
static void
AWindowHandler_releaseANativeWindowEnv(AWindowHandler *p_awh, JNIEnv *p_env,
- enum AWindow_ID id, bool b_clear)
+ enum AWindow_ID id)
{
assert(id < AWindow_Max);
if (p_awh->views[id].p_anw)
{
- /* 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
- && dlsym(RTLD_DEFAULT, "ANativeWindowPriv_connect") == NULL)
- {
- /* Clear the surface by displaying a 1x1 black RGB buffer */
- ANativeWindow *p_anw = p_awh->views[id].p_anw;
- p_awh->anw_api.setBuffersGeometry(p_anw, 1, 1,
- WINDOW_FORMAT_RGB_565);
- ANativeWindow_Buffer buf;
- if (p_awh->anw_api.winLock(p_anw, &buf, NULL) == 0)
- {
- uint16_t *p_bit = buf.bits;
- p_bit[0] = 0x0000;
- p_awh->anw_api.unlockAndPost(p_anw);
- }
- }
p_awh->pf_winRelease(p_awh->views[id].p_anw);
p_awh->views[id].p_anw = NULL;
}
@@ -598,10 +580,8 @@ AWindowHandler_destroy(AWindowHandler *p_awh)
{
if (p_awh->event.b_registered)
JNI_ANWCALL(CallBooleanMethod, setCallback, (jlong)0LL);
- AWindowHandler_releaseANativeWindowEnv(p_awh, p_env, AWindow_Video,
- false);
- AWindowHandler_releaseANativeWindowEnv(p_awh, p_env, AWindow_Subtitles,
- false);
+ AWindowHandler_releaseANativeWindowEnv(p_awh, p_env, AWindow_Video);
+ AWindowHandler_releaseANativeWindowEnv(p_awh, p_env, AWindow_Subtitles);
(*p_env)->DeleteGlobalRef(p_env, p_awh->jobj);
}
@@ -672,11 +652,11 @@ AWindowHandler_getSurface(AWindowHandler *p_awh, enum AWindow_ID id)
void AWindowHandler_releaseANativeWindow(AWindowHandler *p_awh,
- enum AWindow_ID id, bool b_clear)
+ enum AWindow_ID id)
{
JNIEnv *p_env = AWindowHandler_getEnv(p_awh);
if (p_env)
- AWindowHandler_releaseANativeWindowEnv(p_awh, p_env, id, b_clear);
+ AWindowHandler_releaseANativeWindowEnv(p_awh, p_env, id);
}
static inline AWindowHandler *jlong_AWindowHandler(jlong handle)
diff --git a/modules/video_output/android/utils.h b/modules/video_output/android/utils.h
index f4938e9..39fffe9 100644
--- a/modules/video_output/android/utils.h
+++ b/modules/video_output/android/utils.h
@@ -149,7 +149,7 @@ ANativeWindow *AWindowHandler_getANativeWindow(AWindowHandler *p_awh,
* Release the Video/Subtitles Surface/ANativeWindow
*/
void AWindowHandler_releaseANativeWindow(AWindowHandler *p_awh,
- enum AWindow_ID id, bool b_clear);
+ enum AWindow_ID id);
/**
* Pre-ICS hack of ANativeWindow_setBuffersGeometry
*
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 664a937..3ccdae1 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -193,7 +193,7 @@ static void Close (vlc_object_t *obj)
#endif
#ifdef USE_PLATFORM_ANDROID
AWindowHandler_releaseANativeWindow(gl->surface->handle.anativewindow,
- AWindow_Video, false);
+ AWindow_Video);
#endif
free (sys);
}
More information about the vlc-commits
mailing list