[FFmpeg-devel] ffm_seek bug

Kalinsky Vadim gebiet
Tue May 26 16:16:44 CEST 2009

Hello, all,

There is annoying bug in ffserver:
1) Setup any stream in ffserver (test.swf in my case),
2) run ffserver and ffmpeg,
3) wait while size of feed file becomes equal to FileMaxSize,
4) open http://localhost:8090/test.swf

You will see all cashed frames, played in double-triple speed.

It's a bug in ffm_seek1 (ffmdec.c): we perform ffm_seek as in ordinary
file, with simple checks:

* static void ffm_seek1(AVFormatContext *s, int64_t pos1)
* {
*     ...
*     pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
*     pos = FFMAX(pos, FFM_PACKET_SIZE);

but it is not correct, because feed file is big ring buffer:
* static void ffm_seek1(AVFormatContext *s, int64_t pos1)
* {
*     ...
*     pos = pos1 + ffm->write_index;
*     if (pos >= ffm->file_size)
*         pos -= (ffm->file_size - FFM_PACKET_SIZE);

Vadim Kalinsky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffm_seek_ring_buffer.patch
Type: application/octet-stream
Size: 819 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090526/2c4a0f19/attachment.obj>

More information about the ffmpeg-devel mailing list