[vlc-commits] mediacodec: disable direct rendering if VideoPlayerActivity was not started

Felix Abecassis git at videolan.org
Tue Mar 4 11:47:28 CET 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Mon Feb 24 19:11:29 2014 +0100| [4ec53cf794d324dc58f7be9a71ff6c77c231eb4d] | committer: Adrien Maglo

mediacodec: disable direct rendering if VideoPlayerActivity was not started

Signed-off-by: Adrien Maglo <magsoft at videolan.org>

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

 modules/codec/omxil/android_mediacodec.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 8fa68fa..394abcd 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -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) {



More information about the vlc-commits mailing list