mmaldec: send only a single EOS packet on flushing
authorwm4 <nfxjfg@googlemail.com>
Thu, 14 Apr 2016 10:21:22 +0000 (12:21 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sat, 30 Apr 2016 06:26:22 +0000 (08:26 +0200)
Fixes apparent mmal_port_disable() freezes in ffmmal_stop_decoder() when
calling ffmmal_decode() with flush semantics a large number of times in
a row.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/mmaldec.c

index 77838dc..3cc9691 100644 (file)
@@ -477,6 +477,8 @@ static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt,
         if (!is_extradata)
             ctx->packets_sent++;
     } else {
+        if (ctx->eos_sent)
+            goto done;
         if (!ctx->packets_sent) {
             // Short-cut the flush logic to avoid upsetting MMAL.
             ctx->eos_sent = 1;