Commit 61e7080d authored by Thomas Guillem's avatar 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.
parent 4f8ba9b2
......@@ -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);
}
......
......@@ -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;
}
......@@ -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);
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