avcodec/libopusenc: Fix infinite loop on flushing after 0 input
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 27 Aug 2015 10:44:31 +0000 (12:44 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 19 Nov 2015 02:51:37 +0000 (03:51 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6701c92fa4269872856c70c3170a9b3291b46247)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/libopusenc.c

index 7854609..edb0b38 100644 (file)
@@ -326,7 +326,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
         } else
             audio = frame->data[0];
     } else {
-        if (!opus->afq.remaining_samples)
+        if (!opus->afq.remaining_samples || (!opus->afq.frame_alloc && !opus->afq.frame_count))
             return 0;
         audio = opus->samples;
         memset(audio, 0, opus->opts.packet_size * sample_size);