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 <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-05-19 16:56:55 +02:00
parent 6552e23d56
commit ebbc33a42d

View 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);