aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-01-28 17:18:18 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-01-30 14:20:24 -0500
commitf44005b610abc5b1aca5b3191b64a0a0ba65a03f (patch)
tree24d734cac2ac3ef51761ac92b77381c8fc532d0b
parent48f1e5212c90b511c90fa0449655abb06a9edda2 (diff)
downloadffmpeg-f44005b610abc5b1aca5b3191b64a0a0ba65a03f.tar.gz
aacenc: only use the number of input samples provided by the user.
Fixes handling of CODEC_CAP_SMALL_LAST_FRAME.
-rw-r--r--libavcodec/aacenc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 1957420d00..5125bd62a1 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -477,7 +477,7 @@ static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s,
* Channels are reordered from Libav's default order to AAC order.
*/
static void deinterleave_input_samples(AACEncContext *s,
- const float *samples)
+ const float *samples, int nb_samples)
{
int ch, i;
const int sinc = s->channels;
@@ -491,10 +491,12 @@ static void deinterleave_input_samples(AACEncContext *s,
memcpy(&s->planar_samples[ch][1024], &s->planar_samples[ch][2048], 1024 * sizeof(s->planar_samples[0][0]));
/* deinterleave */
- for (i = 2048; i < 3072; i++) {
+ for (i = 2048; i < 2048 + nb_samples; i++) {
s->planar_samples[ch][i] = *sptr;
sptr += sinc;
}
+ memset(&s->planar_samples[ch][i], 0,
+ (3072 - i) * sizeof(s->planar_samples[0][0]));
}
}
@@ -512,7 +514,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
return 0;
if (data) {
- deinterleave_input_samples(s, data);
+ deinterleave_input_samples(s, data, avctx->frame_size);
if (s->psypp)
ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
}