[FFmpeg-devel] [PATCH] Fix MPEG-TS seek and frame positions in general
Ivan Schreter
schreter
Tue Feb 10 11:28:01 CET 2009
Michael Niedermayer wrote:
> On Mon, Feb 09, 2009 at 01:35:58AM +0100, Ivan Schreter wrote:
>
>>
>> So here we go, patch #4 attached.
>>
>
> ive looked more at it and it looks very wrong
> the newly added variable is a duplicate of cur_pkt.pos and you override
> the use of cur_pkt.pos at some places with it.
> i suspect that moving got_packet: up one line has the same effect as your
> rather bloated patch
>
>
Maybe it looks wrong to you, but I still believe it's very right.
Moving the label one line up will address only the case where frame is
completely contained in one packet (where current code sets no position
at all). But for MPEG-TS streams, we get a lot of 188B packets per frame
and each of them is for short time "cur_pkt" with its own position.
Other formats obviously also packetize the data. Current code records
the position of the _last_ packet as start position of the frame, which
is very wrong. The frame starts namely at the _first_ packet. Therefore,
the position of the _first_ packet needs to be stored as frame start
position. BTW, current comment on pkt->pos assignment also indicates
this wrongness. With my patch, the position will be set correctly.
Only possibly the first hunk is not needed, if it is guaranteed that the
condition !st->need_parsing || !st->parser never changes during lifetime
of the stream. Since I'm unsure about it, I also implemented resetting
the position there.
Regards,
Ivan
More information about the ffmpeg-devel
mailing list