summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-06-20 16:29:18 +0200
committerMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-06-23 14:14:15 +0200
commita71d518575a5d048c58a1ecff4dda2b0ba224034 (patch)
tree1c3dd70c48a30a5ab39744c9ef0c6495f4f129df /libavcodec
parentc8550e82449bb22cf78eddd8a656eaafa31cb88c (diff)
lavc/mediacodec: discard 0-sized buffers
Their only purpose is to carry the end of stream flag.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mediacodecdec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 68df885c77..6b7cdb4f97 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;