[vlc-commits] mediacodec: add missing exception handling code after dequeue{Input, Output}Buffer

Felix Abecassis git at videolan.org
Tue Feb 18 20:10:51 CET 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Tue Feb 18 19:27:17 2014 +0100| [6eeac3302cb72b6093701c1a442a0b3895f91196] | committer: Jean-Baptiste Kempf

mediacodec: add missing exception handling code after dequeue{Input, Output}Buffer

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/omxil/android_mediacodec.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 06ece8f..2911711 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -552,6 +552,11 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic)
     while (1) {
         int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_output_buffer,
                                           p_sys->buffer_info, (jlong) 0);
+        if ((*env)->ExceptionOccurred(env)) {
+            (*env)->ExceptionClear(env);
+            return;
+        }
+
         if (index >= 0) {
             if (!p_sys->pixel_format) {
                 msg_Warn(p_dec, "Buffers returned before output format is set, dropping frame");
@@ -748,6 +753,10 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
     int attempts = 0;
     while (true) {
         int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout);
+        if ((*env)->ExceptionOccurred(env)) {
+            (*env)->ExceptionClear(env);
+            break;
+        }
         if (index < 0) {
             GetOutput(p_dec, env, &p_pic);
             if (p_pic) {



More information about the vlc-commits mailing list