[Ffmpeg-devel] [PATCH] remove useless check in amr.c
Michael Niedermayer
michaelni
Sat Feb 3 00:52:26 CET 2007
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;
}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070203/a0154d48/attachment.pgp>
More information about the ffmpeg-devel
mailing list