[FFmpeg-soc] [soc]: r2788 - aac/aac.c

Robert Swain robert.swain at gmail.com
Tue Jul 15 15:31:13 CEST 2008


2008/7/15 Benjamin Larsson <banan at ludd.ltu.se>:
> superdump wrote:
>> Author: superdump
>> Date: Tue Jul 15 15:24:22 2008
>> New Revision: 2788
>>
>> Log:
>> Dynamically allocate an aligned buffer for interleaved_output rather than
>> having a mostly redundant large array in the context
>>
>> [...]
>>
>> +    // allocate appropriately aligned buffer for interleaved output
>> +    if(!ac->interleaved_output)
>> +        ac->interleaved_output = av_malloc(channels * 1024 * sizeof(float));
>> +    else if(channels != avctx->channels) {
>> +        av_free(ac->interleaved_output);
>> +        ac->interleaved_output = av_malloc(channels * 1024 * sizeof(float));
>> +    }
>> +
>>
>
> You should only reallocate when there are more channels then before.

This code is actually very similar to what was there originally. I
probably shouldn't have applied the patch in the first place and
removed the realloc replacing with some logic plus av_free and
av_malloc. As I've done it, I'm going to carry on, but in future I'll
try to avoid such things.

Rob



More information about the FFmpeg-soc mailing list