[vlc-commits] mediacodec: cleanly abort DecodeVideo if GetOutput failed

Thomas Guillem git at videolan.org
Fri Oct 24 15:53:50 CEST 2014


vlc | branch: master | Thomas Guillem <tom at gllm.fr> | Thu Oct 23 12:56:43 2014 +0200| [ab4c04f2f5545dcc3cae7ebffe8d28f3e2c5a915] | committer: Jean-Baptiste Kempf

mediacodec: cleanly abort DecodeVideo if GetOutput failed

- Fix possible infinite loop with sw rendering if GetOutput failed.
- Don't return a pic and don't release the block in case of error_state.

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

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

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

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index 44184c6..53b8143 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -947,6 +947,8 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
 
         if (index < 0) {
             GetOutput(p_dec, env, &p_pic, timeout);
+            if (p_sys->error_state)
+                break;
             if (p_pic) {
                 /* If we couldn't get an available input buffer but a
                  * decoded frame is available, we return the frame
@@ -1014,6 +1016,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
         p_sys->decoded = true;
         break;
     }
+    if (p_sys->error_state) {
+        if (p_pic)
+            decoder_DeletePicture(p_dec, p_pic);
+        jni_detach_thread();
+        return NULL;
+    }
     if (!p_pic)
         GetOutput(p_dec, env, &p_pic, 0);
     jni_detach_thread();



More information about the vlc-commits mailing list