From f4fb29520a81897c2b20a86446efcf9816425d26 Mon Sep 17 00:00:00 2001 From: jbr Date: Tue, 14 Apr 2009 03:48:26 +0000 Subject: [PATCH] Support audio sample formats than S16 when encoding a small last frame. git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18505 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- ffmpeg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 4be4b92681..ce36694892 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1465,8 +1465,9 @@ static int output_packet(AVInputStream *ist, int ist_index, ret = 0; /* encode any samples remaining in fifo */ if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { + int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3; int fs_tmp = enc->frame_size; - enc->frame_size = fifo_bytes / (2 * enc->channels); + enc->frame_size = fifo_bytes / (osize * enc->channels); av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL); ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples); pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den, -- 2.11.4.GIT