]> git.sesse.net Git - vlc/commitdiff
mediacodec: add missing exception handling code after dequeue{Input, Output}Buffer
authorFelix Abecassis <felix.abecassis@gmail.com>
Tue, 18 Feb 2014 18:27:17 +0000 (19:27 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 18 Feb 2014 19:10:38 +0000 (20:10 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/codec/omxil/android_mediacodec.c

index 06ece8f496cb4b319c7529d314980817d65addd1..29117110e1f22b851f32371f4e2baacf67442272 100644 (file)
@@ -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) {