Commit 4592c85f authored by Justin Ruggles's avatar Justin Ruggles Committed by Michael Niedermayer

Flush final frames in libfaac encoder.

Gives decoded output identical in length to faac commandline encoder.
Fixes Issue 670.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
(cherry picked from commit 243f8241)
parent 5255acc6
...@@ -124,10 +124,11 @@ static int Faac_encode_frame(AVCodecContext *avctx, ...@@ -124,10 +124,11 @@ static int Faac_encode_frame(AVCodecContext *avctx,
{ {
FaacAudioContext *s = avctx->priv_data; FaacAudioContext *s = avctx->priv_data;
int bytes_written; int bytes_written;
int num_samples = data ? avctx->frame_size : 0;
bytes_written = faacEncEncode(s->faac_handle, bytes_written = faacEncEncode(s->faac_handle,
data, data,
avctx->frame_size * avctx->channels, num_samples * avctx->channels,
frame, frame,
buf_size); buf_size);
...@@ -161,6 +162,7 @@ AVCodec ff_libfaac_encoder = { ...@@ -161,6 +162,7 @@ AVCodec ff_libfaac_encoder = {
Faac_encode_init, Faac_encode_init,
Faac_encode_frame, Faac_encode_frame,
Faac_encode_close, Faac_encode_close,
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"), .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
.profiles = NULL_IF_CONFIG_SMALL(profiles), .profiles = NULL_IF_CONFIG_SMALL(profiles),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment