[vlc-devel] [PATCH] mediacodec: try to return an output frame if we failed to get an available input buffer.

Felix Abecassis felix.abecassis at gmail.com
Mon Nov 4 16:17:47 CET 2013


---
 modules/codec/omxil/android_mediacodec.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c
index d8cf09f..f9ad889 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -528,7 +528,16 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
     while (true) {
         int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout);
         if (index < 0) {
-            GetOutput(p_dec, env, &p_pic, timeout > 0);
+            GetOutput(p_dec, env, &p_pic, 0);
+            if (p_pic) {
+                /* If we couldn't get an available input buffer but a
+                 * decoded frame is available, we return the frame
+                 * without assigning NULL to *pp_block. The next call
+                 * to DecodeVideo will try to send the input packet again.
+                 */
+                (*myVm)->DetachCurrentThread(myVm);
+                return p_pic;
+            }
             timeout = 30;
             continue;
         }
-- 
1.8.3.2




More information about the vlc-devel mailing list