[MPlayer-dev-eng] stream seek eof handling

Laurent laurent.aml at gmail.com
Thu Sep 25 16:01:37 CEST 2008


Hi,

I've been tracking an issue with mp4 file header parsing that created
an infinite loop in libavformat (in mov.c).
The infinite loop has been prevented in libavformat, though, the root
cause of this issue seems to come from MPlayer, as ffmpeg is not
impacted by it.

I have been pointed to the bug #1267, that may be the issue I encountered.

Basically, stream/stream.c:stream_seek_long() behavior is inconsistent
regarding eof handling.
In my case, stream_seek_long() fails to move the stream position
because eof has been reached in a previous stream_fill_buffer() call.
As the stream position never moves forward, libavformat reads in an
infinite loop.

This issue comes from the handling of position at or after EOF in streams.
Sometimes, it is considered as a valid position, sometimes not.
Sometimes, eof flag is cleared during a seek, sometimes not.

Does someone knows what should be the right behavior in stream/stream.c:
* Shall the stream eof flag be cleared when seek succeeds?
* Shall EOF be a valid position for seek?
* Shall positions past EOF be valid for seek?

As a comparison, the system lseek has such behavior.

Thanks,

Laurent



More information about the MPlayer-dev-eng mailing list