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

Felix Abecassis git at videolan.org
Mon Nov 4 21:00:08 CET 2013


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Mon Nov  4 16:17:47 2013 +0100| [10ef73dcf1208f9eebe48c8faee1aac0df6734d7] | committer: Martin Storsjö

mediacodec: try to return an output frame if we failed to get an available input buffer.

Previously we would only return one frame even if multiple output
frames were available, dropping all but the last one, while waiting
for a free input buffer. Instead return the first output buffer
and don't consume the input buffer at all in that case.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 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 fb435b4..c078b2b 100644
--- a/modules/codec/omxil/android_mediacodec.c
+++ b/modules/codec/omxil/android_mediacodec.c
@@ -536,7 +536,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;
         }



More information about the vlc-commits mailing list