Commit 4ec53cf7 authored by Felix Abecassis's avatar Felix Abecassis Committed by Adrien Maglo

mediacodec: disable direct rendering if VideoPlayerActivity was not started

Signed-off-by: default avatarAdrien Maglo <magsoft@videolan.org>
parent ec78f321
......@@ -52,6 +52,7 @@ extern jobject jni_LockAndGetAndroidJavaSurface();
extern void jni_UnlockAndroidSurface();
extern void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den);
extern void jni_EventHardwareAccelerationError();
extern bool jni_IsVideoPlayerActivityCreated();
struct decoder_sys_t
{
......@@ -399,7 +400,10 @@ static int OpenDecoder(vlc_object_t *p_this)
(*env)->DeleteLocalRef(env, bytebuf);
}
p_sys->direct_rendering = var_InheritBool(p_dec, CFG_PREFIX "dr");
/* If the VideoPlayerActivity is not started, MediaCodec opaque
direct rendering should be disabled since no surface will be
attached to the JNI. */
p_sys->direct_rendering = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr");
if (p_sys->direct_rendering) {
jobject surf = jni_LockAndGetAndroidJavaSurface();
if (surf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment