[FFmpeg-devel] [PATCH] Make sure AVFormatContext->start_time is initialized after the first patch

Martin Storsjö martin
Tue May 25 21:30:33 CEST 2010

On Tue, 25 May 2010, Michael Niedermayer wrote:

> The problem might be that ffserver calls av_seek_frame()
> with that the first packet demuxed might no longer correspond to the
> first packet.
> thus i think its not unreasonable if lavf doesnt set start_time to the
> first dts/pts once seeking has happened

Hmm, good point.

But given this, since we cannot absolutely rely on start_time being 
initialized, the if statement

    if (ist->start_time != AV_NOPTS_VALUE)
        c->cur_pts -= av_rescale_q(ist->start_time, ist->time_base, AV_TIME_BASE_Q);

in ffserver.c must have an else branch. If not, c->cur_pts will have a 
value in the wrong range (absolute instead of relative), which completely 
messes things up. And IMO, this would be fixed by the attached patch.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffserver-Set-cur_pts-to-0-if-no-start-time-is-availa.patch
Type: text/x-diff
Size: 1230 bytes
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100525/f47ade92/attachment.patch>

More information about the ffmpeg-devel mailing list