[vlc-commits] mediacodec: remove external jni_EventHardwareAccelerationError

Thomas Guillem git at videolan.org
Mon Feb 22 17:14:05 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb 22 16:58:09 2016 +0100| [61e7080da3d310cc077ca6a8cef485fa428ebf13] | committer: Thomas Guillem

mediacodec: remove external jni_EventHardwareAccelerationError

Replace it by AWindowHandler_sendHardwareAccelerationError.
This avoid a dependency towards android libvlcjni.

This solution is not perfect, it will be removed when decoder fallback is
implemented.

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

 modules/codec/omxil/mediacodec.c     |    8 +++-----
 modules/video_output/android/utils.c |   14 ++++++++++++++
 modules/video_output/android/utils.h |    5 +++++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index f7fcb5b..1331a44 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -50,9 +50,6 @@
 #include "omxil_utils.h"
 #include "../../video_output/android/android_window.h"
 
-/* JNI functions to get/set an Android Surface object. */
-extern void jni_EventHardwareAccelerationError(); // TODO REMOVE
-
 #define BLOCK_FLAG_CSD (0x01 << BLOCK_FLAG_PRIVATE_SHIFT)
 
 /* Codec Specific Data */
@@ -115,7 +112,7 @@ struct decoder_sys_t
     /* If true, the first input block was successfully dequeued */
     bool            b_input_dequeued;
     bool            b_aborted;
-    /* TODO: remove. See jni_EventHardwareAccelerationError */
+    /* TODO: remove */
     bool            b_error_signaled;
 
     union
@@ -1476,7 +1473,8 @@ end:
         if (!p_sys->b_error_signaled) {
             /* Signal the error to the Java.
              * TODO: remove this when there is a decoder fallback */
-            jni_EventHardwareAccelerationError();
+            if (p_dec->fmt_in.i_cat == VIDEO_ES && p_sys->u.video.p_awh)
+                AWindowHandler_sendHardwareAccelerationError(p_sys->u.video.p_awh);
             p_sys->b_error_signaled = true;
             vlc_cond_broadcast(&p_sys->cond);
         }
diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index abd063a..24aba61 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -65,6 +65,8 @@ static struct
         jmethodID setCallback;
         jmethodID setBuffersGeometry;
         jmethodID setWindowLayout;
+        /* TODO: temporary, to remove when VLC has decoder fallback */
+        jmethodID sendHardwareAccelerationError;
     } AndroidNativeWindow;
 } jfields;
 
@@ -432,6 +434,7 @@ InitJNIFields(JNIEnv *env, vlc_object_t *p_obj, AWindowHandler *p_awh)
     GET_METHOD(setCallback, "setCallback", "(J)Z");
     GET_METHOD(setBuffersGeometry, "setBuffersGeometry", "(Landroid/view/Surface;III)Z");
     GET_METHOD(setWindowLayout, "setWindowLayout", "(IIIIII)V");
+    GET_METHOD(sendHardwareAccelerationError, "sendHardwareAccelerationError", "()V");
 #undef CHECK_EXCEPTION
 #undef GET_METHOD
 
@@ -747,3 +750,14 @@ AWindowHandler_setWindowLayout(AWindowHandler *p_awh,
              i_visible_width,i_visible_height, i_sar_num, i_sar_den);
     return VLC_SUCCESS;
 }
+
+int
+AWindowHandler_sendHardwareAccelerationError(AWindowHandler *p_awh)
+{
+    JNIEnv *p_env = AWindowHandler_getEnv(p_awh);
+    if (!p_env)
+        return VLC_EGENERIC;
+
+    JNI_CALL(CallVoidMethod, sendHardwareAccelerationError);
+    return VLC_SUCCESS;
+}
diff --git a/modules/video_output/android/utils.h b/modules/video_output/android/utils.h
index 956f5e2..4637718 100644
--- a/modules/video_output/android/utils.h
+++ b/modules/video_output/android/utils.h
@@ -171,3 +171,8 @@ int AWindowHandler_setWindowLayout(AWindowHandler *p_awh,
                                    int i_width, int i_height,
                                    int i_visible_width, int i_visible_height,
                                    int i_sar_num, int i_sar_den);
+
+/* Signal a critical error
+ * TODO: remove this when there is a decoder fallback */
+int
+AWindowHandler_sendHardwareAccelerationError(AWindowHandler *p_awh);



More information about the vlc-commits mailing list