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

Baptiste Coudurier baptiste.coudurier
Thu Jul 31 04:24:41 CEST 2008


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 ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcm_read_seek_fail.patch
Type: text/x-diff
Size: 480 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080730/668cc560/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seek_test_reg_diff.patch
Type: text/x-diff
Size: 36985 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080730/668cc560/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: url_fseek_fail.patch
Type: text/x-diff
Size: 788 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080730/668cc560/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: av_seek_frame_generic_fseek_fail.patch
Type: text/x-diff
Size: 1324 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080730/668cc560/attachment-0003.patch>



More information about the ffmpeg-devel mailing list