[FFmpeg-devel] [PATCH] Move av_open_input_file probe loop to its own method

Michael Niedermayer michaelni
Sun Mar 21 18:04:28 CET 2010


On Sat, Mar 20, 2010 at 05:14:40PM -0400, Micah F. Galizia wrote:
[..]
> Sorry,the last one has a memory leak -- probe_buffer9.diff corrects it.
>
> -- 
> Micah F. Galizia
> micahgalizia at gmail.com
>
> "The mark of an immature man is that he wants to die nobly for a cause, 
> while the mark of the mature man is that he wants to live humbly for one."  
>  --W. Stekel

>  utils.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> e3511efa72382199d1a4855b4a761ad0964c0ead  probe_buffer9.diff

> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c	(revision 22608)
> +++ libavformat/utils.c	(working copy)
> @@ -478,7 +478,8 @@
>          return AVERROR(EINVAL);
>      }
>  
> -    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0; probe_size<<=1){
> +    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0;
> +        probe_size = FFMIN(probe_size<<1, max_probe_size)){

hmm, this doesnt behave reasonable at all, the check is never false and
theres lots of dead code after the loop and you duplicate this inside the loop
incorrectly without a goto fail where a break should do i think

something like:
FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))
might simplify it but maybe there are better alternatives ..

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100321/db8192a8/attachment.pgp>



More information about the ffmpeg-devel mailing list