From ebbc33a42d1d2f3a9b43444d66416284630bf2f4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 19 May 2014 16:56:55 +0200 Subject: [PATCH] avcodec/libmp3lame: do not attempt to flush lame if no data was input 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 --- libavcodec/libmp3lame.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index e6cb64b876..a8c39cc6c7 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -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);