[vlc-commits] mediacodec: jni: add missing exception check

Thomas Guillem git at videolan.org
Mon Jul 27 11:21:57 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jul 27 11:20:22 2015 +0200| [4f0e689245cfc657540dcb8c7faae0d8b27df81e] | committer: Thomas Guillem

mediacodec: jni: add missing exception check

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

 modules/codec/omxil/mediacodec_jni.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c
index 5d659e4..6d6b098 100644
--- a/modules/codec/omxil/mediacodec_jni.c
+++ b/modules/codec/omxil/mediacodec_jni.c
@@ -649,8 +649,15 @@ static int PutInput(mc_api *api, const void *p_buf, size_t i_size,
         j_mc_buf = (*env)->GetObjectArrayElement(env, p_sys->input_buffers,
                                                  index);
     else
+    {
         j_mc_buf = (*env)->CallObjectMethod(env, p_sys->codec,
                                             jfields.get_input_buffer, index);
+        if (CHECK_EXCEPTION())
+        {
+            msg_Err(api->p_obj, "Exception in MediaCodec.getInputBuffer");
+            return VLC_EGENERIC;
+        }
+    }
     j_mc_size = (*env)->GetDirectBufferCapacity(env, j_mc_buf);
     p_mc_buf = (*env)->GetDirectBufferAddress(env, j_mc_buf);
     if (j_mc_size < 0)
@@ -716,9 +723,16 @@ static int GetOutput(mc_api *api, mc_api_out *p_out, mtime_t i_timeout)
                 buf = (*env)->GetObjectArrayElement(env, p_sys->output_buffers,
                                                     i_index);
             else
+            {
                 buf = (*env)->CallObjectMethod(env, p_sys->codec,
                                                jfields.get_output_buffer,
                                                i_index);
+                if (CHECK_EXCEPTION())
+                {
+                    msg_Err(api->p_obj, "Exception in MediaCodec.getOutputBuffer");
+                    return VLC_EGENERIC;
+                }
+            }
             //jsize buf_size = (*env)->GetDirectBufferCapacity(env, buf);
             ptr = (*env)->GetDirectBufferAddress(env, buf);
 



More information about the vlc-commits mailing list