[Ffmpeg-devel] [PATCH] remove useless check in amr.c

Måns Rullgård mru
Sat Feb 3 01:11:17 CET 2007


Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
>
> On Fri, Feb 02, 2007 at 06:47:22PM +0000, M?ns Rullg?rd wrote:
>> Benoit Fouet <benoit.fouet at purplelabs.com> writes:
>> 
>> > Hi,
>> >
>> > it seems to me there is an unneeded check in amr.c file
>> > here is a patch to suppress it
>> >
>> > Ben
>> >
>> > Index: libavcodec/amr.c
>> > ===================================================================
>> > --- libavcodec/amr.c	(revision 7807)
>> > +++ libavcodec/amr.c	(working copy)
>> > @@ -436,11 +436,6 @@
>> >
>> >      /* av_log(NULL,AV_LOG_DEBUG,"amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",buf,buf_size,s->frameCount); */
>> >
>> > -    if(buf_size==0) {
>> > -        /* nothing to do */
>> > -        return 0;
>> > -    }
>> > -
>> >      dec_mode = (buf[0] >> 3) & 0x000F;
>> 
>> Rejected.  If buf_size is 0 that read of buf[0] is invalid.
>
> buf_size cannot be 0 there see:
> avcodec_decode_audio*:
> ...
>     if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
>         ret = avctx->codec->decode(avctx, samples, frame_size_ptr,
>                                 buf, buf_size);
>         avctx->frame_number++;
>     }else{
>         ret= 0;
>         *frame_size_ptr=0;
>     }

Quite.  Then the patch is of course OK.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list