[FFmpeg-devel] [PATCH] fix seeking and index generation

Michael Chinen mchinen
Sun Aug 8 17:40:43 CEST 2010


On Sat, Aug 7, 2010 at 11:48 PM, Baptiste Coudurier
<baptiste.coudurier at gmail.com> wrote:
> Hi,
>
> On 8/6/10 5:14 PM, Michael Chinen wrote:
>>
>> Hi,
>>
>> This patch fixes seeking for methods that use a stream's index_entries.
>> index_entries[i]->pos was being set wrong (not at the start of frame
>> headers.)
>> index based Seeking seemed to work before because most decoders or
>> parsers handle this,
>> but some cases like at the end of the file av_read_frame_internal
>> would try to create
>> indexes that contain several indexes with the same pos for different
>> timestamps.
>> Also it means that the seeking could be inaccurate in some cases and even
>> more so for parsers that buffer several frames (FLAC)
>
> pos must be set to the underlying format packet start (TS packet, PES packet
> for PS, and GXF packet I think), for raw format this doesn't apply of
> course.

Thanks.  I found a much better way to fix this, but I'm having some
issues testing, and will submit a new patch tomorrow.

I've looked at gxf and haven't figured out if your comment means I
should change something with respect to the patch.
This patch puts pos at the start of the packet returned by the parser
(only for demuxers that use parsers and a generic index.)
This is because I think we want to seek to a point where the parser will
be able to use the next byte as the start of the valid packet it will return.
If there is something incorrect with that I am missing something.
Do you mean a valid packet returned by the parser does not start at
the position that should go into index_entries->pos, but it should be at
some offset after this?

Michael



More information about the ffmpeg-devel mailing list