[FFmpeg-cvslog] lavc/mediacodec: discard 0-sized buffers

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


ffmpeg | branch: master | Matthieu Bouron <matthieu.bouron at stupeflix.com> | Mon Jun 20 16:29:18 2016 +0200| [a71d518575a5d048c58a1ecff4dda2b0ba224034] | committer: Matthieu Bouron

lavc/mediacodec: discard 0-sized buffers

Their only purpose is to carry the end of stream flag.

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

 libavcodec/mediacodecdec.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 68df885..6b7cdb4 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -474,6 +474,7 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
                 " flags=%" PRIu32 "\n", index, info.offset, info.size,
                 info.presentationTimeUs, info.flags);
 
+        if (info.size) {
         data = ff_AMediaCodec_getOutputBuffer(codec, index, &size);
         if (!data) {
             av_log(avctx, AV_LOG_ERROR, "Failed to get output buffer\n");
@@ -488,6 +489,12 @@ int ff_mediacodec_dec_decode(AVCodecContext *avctx, MediaCodecDecContext *s,
         *got_frame = 1;
         s->queued_buffer_nb--;
         s->dequeued_buffer_nb++;
+        } else {
+            status = ff_AMediaCodec_releaseOutputBuffer(codec, index, 0);
+            if (status < 0) {
+                av_log(avctx, AV_LOG_ERROR, "Failed to release output buffer\n");
+            }
+        }
 
     } else if (ff_AMediaCodec_infoOutputFormatChanged(codec, index)) {
         char *format = NULL;



More information about the ffmpeg-cvslog mailing list