[FFmpeg-devel] base av_read_frame() function for seeking in mpegps files
Sun Jul 26 23:08:44 CEST 2009
On 07/26/2009 10:48 AM, Ivan Schreter wrote:
> zhentan feng wrote:
>> I am not clear why the parser return the wrong frame size when fist call
>> av_read_frame() after seek.
>> anyone explain it futher?
> I looked at the code. Consider following example: A PES packet contains
> some rest of previous frame and start of a new frame. In normal case,
> the rest of the previous frame is simply glued to the data in the buffer
> and returned as whole frame with PTS of the previous frame during
> processing of this PES packet in the parser.
> However, after a seek, parser is reset. Instead of ignoring the portion
> of previous frame, it returns it back as a frame with PTS of the current
> frame. Beginning of current frame (to which PTS actually belongs) is put
> into the buffer and when the frame is completed, it is returned back
> without PTS.
> So, we have one corrupted frame with the timestamp of the actual frame
> before actual frame (most probably of correct size, but I didn't check),
> which is returned without timestamp.
> Code in mpegvideo_parser.c and possibly in ff_combine_frame() must be
> fixed to take this case into account (i.e., newly-initialized parser and
> rest of old frame in the first packet received from the stream).
Yes I think this partial frame must be discarded and it's easy to do
that by checking headers.
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel