[FFmpeg-cvslog] lavc/mediacodec: increase buffer dequeue timeout when the codec needs to be drained

Matthieu Bouron git at videolan.org
Thu Jun 23 14:17:02 CEST 2016


ffmpeg | branch: master | Matthieu Bouron <matthieu.bouron at stupeflix.com> | Mon Jun 20 18:15:21 2016 +0200| [55816c926955799de1ebb7e0a03a0ebb5ea95bcc] | committer: Matthieu Bouron

lavc/mediacodec: increase buffer dequeue timeout when the codec needs to be drained

Increase buffer dequeue timeout when the codec needs to be drained as it
could happen that no input buffer is available when we receive a null
packet for the first time (meaning we are unable to signal end of stream
and mark the codec as draining).

Fixes potential loss of last frames after sending a null packet.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55816c926955799de1ebb7e0a03a0ebb5ea95bcc
---

 libavcodec/mediacodecdec.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 7cef90b..e29637e 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -446,9 +446,9 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
         }
     }
 
-    if (s->flushing) {
-        /* If the codec is flushing, block for a fair amount of time to
-        * ensure we got a frame */
+    if (need_flushing || s->flushing) {
+        /* If the codec is flushing or need to be flushed, block for a fair
+         * amount of time to ensure we got a frame */
         output_dequeue_timeout_us = OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US;
     } else if (s->dequeued_buffer_nb == 0) {
         /* If the codec hasn't produced any frames, do not block so we



More information about the ffmpeg-cvslog mailing list