[FFmpeg-devel] [PATCH] libmp3lame: 32 bit encoding

Peter Belkner pbelkner at snafu.de
Sat Apr 16 23:13:02 CEST 2011


On 16.04.2011 22:16, Reimar Döffinger wrote:
> On Sat, Apr 16, 2011 at 08:12:35PM +0200, Peter Belkner wrote:
>    
>> On 16.04.2011 17:14, Michael Niedermayer wrote:
>>      
>>>> On the other hand I corrected casting the frame buffer provided by
>>>> FFmpeg to (int32_t *).
>>>>          
>>> your mono code looks like it would fail with 64bit long
>>>        
>> Fixed it with it's own copy loop, cf. revised patch below.
>>      
> Why are you not just using the lame_encode_buffer_int function?
>    

What's the difference? As far as I know "int" has also platform 
dependent size.

>    
>> +    if (AV_SAMPLE_FMT_S32 == avctx->sample_fmt) {
>> +        s->s32_data.left = av_malloc(avctx->frame_size * sizeof(long));
>> +        s->s32_data.right = av_malloc(avctx->frame_size * sizeof(long));
>> +
>> +        if (NULL == s->s32_data.left || NULL == s->s32_data.right)
>> +            return AVERROR_NOMEM;
>>      
> That's a memleak if only one allocation fails.
> Also in FFmpeg we don't usually do the comparisons in this
> switched-around way and use e.g. !s->s32_data.left instead
> of the comparison with NULL.
>    

The revised patch below corrects it.

Peter
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libmp3lame-32-bit-revised-3.patch
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110416/26849d98/attachment.ksh>


More information about the ffmpeg-devel mailing list