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

Michael Niedermayer michaelni
Tue Mar 23 15:57:10 CET 2010


On Mon, Mar 22, 2010 at 08:41:44PM -0400, Micah F. Galizia wrote:
> On 10-03-21 01:04 PM, Michael Niedermayer wrote:
>> 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
>
> I'm not sure I understand all of what your saying or agree that the code is 
> dead. Also, I dont see why a using a goto and adding a fail label is 
> preferred to returning an error, which will do the same job (with less code 
> in this case).

i possibly was looking at an outdated piece of code from my local tree
which made my comment partial nonsense

the error code though is wrong as stefano said

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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- 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/20100323/2b5aac77/attachment.pgp>



More information about the ffmpeg-devel mailing list