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

Diego Biurrun diego
Mon Feb 5 10:11:33 CET 2007


On Sat, Feb 03, 2007 at 12:11:17AM +0000, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> 
> > On Fri, Feb 02, 2007 at 06:47:22PM +0000, M?ns Rullg?rd wrote:
> >> Benoit Fouet <benoit.fouet at purplelabs.com> writes:
> >> 
> >> > it seems to me there is an unneeded check in amr.c file
> >> > here is a patch to suppress it
> >> >
> >> > --- 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.

Patch applied.

Diego





More information about the ffmpeg-devel mailing list