aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2016-04-14 12:21:21 +0200
committerAnton Khirnov <anton@khirnov.net>2016-04-30 08:19:58 +0200
commit46aaad78c3cf03d43e7c9ca1d4a8b8a71fb0527d (patch)
tree2a1add9c255e33ff23e4c2c7b8497757dbd2a1bc
parent9a382f363950c0aab1500aa0937f73bf4dde9ee3 (diff)
downloadffmpeg-46aaad78c3cf03d43e7c9ca1d4a8b8a71fb0527d.tar.gz
mmaldec: correct package buffering accounting
The assert in ffmmal_stop_decoder() could trigger sometimes. The packets_buffered counter was indeed not correctly maintained, and packets were not subtracted from it if they were still in the waiting queue. For some reason, this happened especially with VC-1. Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/mmaldec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 6015e54867..77838dc509 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -161,6 +161,9 @@ static void ffmmal_stop_decoder(AVCodecContext *avctx)
ctx->waiting_buffers = buffer->next;
+ if (buffer->flags & MMAL_BUFFER_HEADER_FLAG_FRAME_END)
+ avpriv_atomic_int_add_and_fetch(&ctx->packets_buffered, -1);
+
av_buffer_unref(&buffer->ref);
av_free(buffer);
}