avcodec/libmp3lame: do not attempt to flush lame if no data was input
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 May 2014 14:56:55 +0000 (16:56 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 May 2014 15:37:26 +0000 (17:37 +0200)
this prevents the creation of a packet even though no single sample has ever
been input, which some confusion in the timestamp generation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libmp3lame.c

index e6cb64b..a8c39cc 100644 (file)
@@ -208,6 +208,8 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
         default:
             return AVERROR_BUG;
         }
+    } else if (!s->afq.frame_alloc) {
+        lame_result = 0;
     } else {
         lame_result = lame_encode_flush(s->gfp, s->buffer + s->buffer_index,
                                         s->buffer_size - s->buffer_index);