[FFmpeg-devel] [PATCH] avoid infinite loop when seeking flv and non seekable input

Baptiste Coudurier baptiste.coudurier
Thu Jul 31 21:47:44 CEST 2008


Michael Niedermayer wrote:
> On Wed, Jul 30, 2008 at 07:24:41PM -0700, Baptiste Coudurier wrote:
>> Baptiste Coudurier wrote:
>>> Michael Niedermayer wrote:
>>>>>> [...]
>>>>>>
>>>>>> This is not the correct solution i think.
>>>>>> I think the code in the else below may be buggy when seek() fails, it can
>>>>>> fail for non streamed things as well (network problems, old scratched cd...)
>>>>>> I think moving 
>>>>>>             s->buf_end = s->buffer;
>>>>>>         }
>>>>>>         s->buf_ptr = s->buffer;
>>>>>>
>>>>>> after
>>>>>> if (!s->seek || (res = s->seek(s->opaque, offset, SEEK_SET)) < 0)
>>>>>>             return res;
>>>>>>
>>>>>> might help ?
>>>>>>
>>>>> I see, it works but seek regression tests fail:
>>>>> Patch and regression diff attached.
>>>> hmm, i guess there are more bugs in the code that need to be fixed first.
>>>> I would guess they are seeks that dont check the return value and previously
>>>> failed due to the messed up internal byteio state.
>>>>
>>> Ok, I'll dig further.
>>>
>> I dig further and I found pcm_read_seek did not check url_fseek return
>> value. Patch attached and with seek reg diff. What do you think of the
>> diff ? It looks correct to me, ie returning -1 for negative timestamps
>> in audio files only.
>>
>> Also updated av_seek_frame_generic patch, I missed one call,
>> av_seek_frame on image2 now return -22 (EINVAL) because ByteIOContext is
>> not set, this is normal. I'll apply patches separately of course.
>>
>> How does it look like ?
> 
> looks all good
> 

Nice, applied, will investigate the move of av_read_frame_flush now.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA




More information about the ffmpeg-devel mailing list