On Sat, Jan 28, 2012 at 2:59 PM, Justin Ruggles
<[email protected]> wrote:
> Currently, any samples in the final frame are not decoded because they are
> only represented by one frame instead of two. So we encode two final frames to
> cover both the analysis delay and the MDCT delay.
> ---
> As an example, if you encode an input file with 1024 samples with current git,
> the decoded output from avconv will just be silence, and the output from faad
> will be an empty wav file.
>
>  libavcodec/aacenc.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> index db8308d..c0d1930 100644
> --- a/libavcodec/aacenc.c
> +++ b/libavcodec/aacenc.c
> @@ -509,14 +509,12 @@ static int aac_encode_frame(AVCodecContext *avctx,
>     int chan_el_counter[4];
>     FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
>
> -    if (s->last_frame)
> +    if (s->last_frame == 2)
>         return 0;
>
> -    if (data) {
> -        deinterleave_input_samples(s, data, avctx->frame_size);
> -        if (s->psypp)
> -            ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
> -    }
> +    deinterleave_input_samples(s, data, data ? avctx->frame_size : 0);
> +    if (s->psypp)
> +        ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
>
>     if (!avctx->frame_number)
>         return 0;
> @@ -647,7 +645,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
>     }
>
>     if (!data)
> -        s->last_frame = 1;
> +        s->last_frame++;
>
>     return put_bits_count(&s->pb)>>3;
>  }
> --

Looks good
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to