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

Micah F. Galizia micahgalizia
Tue Mar 23 23:43:15 CET 2010


On 10-03-23 10:57 AM, Michael Niedermayer wrote:
> 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

Corrected in version 11.

Thanks again!
-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: probe_buffer11.diff
Type: text/x-diff
Size: 906 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100323/34aef2fb/attachment.diff>



More information about the ffmpeg-devel mailing list