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

Howard Chu hyc
Fri May 28 23:09:03 CEST 2010


Martin Storsj? wrote:
> On Fri, 28 May 2010, Baptiste Coudurier wrote:
>
>> On 05/25/2010 11:57 AM, Michael Niedermayer wrote:
>>> On Tue, May 25, 2010 at 12:54:50AM +0300, Martin Storsj? wrote:
>>>> Hi,
>>>>
>>>> When discussing a ffserver patch with Baptiste, he insisted that if
>>>> AVFormatContext->start_time isn't initialized after the first packet, it's
>>>> a bug that should be fixed within libavformat, instead of handled in
>>>> ffserver.
>>>>
>>>> This attached patch is one way of solving it, although I'm not sure if
>>>> this is the correct way.
>>>
>>> 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
>>
>> Hummm, av_find_stream_info should set the start_time however.
>> Isn't av_find_stream_info called ?
>
> As far as I can see in open_input_stream, we first call
> av_find_stream_info, then a few lines later do av_seek_frame.

Bypassing the av_seek_frame call also works if playing from the beginning of 
the stream. I haven't tried playing from any other starting point.

--- ffserver.c  (revision 23363)
+++ ffserver.c  (working copy)
@@ -2192,7 +2192,7 @@
      }

  #if 1
-    if (c->fmt_in->iformat->read_seek)
+    if (stream_pos && c->fmt_in->iformat->read_seek)
          av_seek_frame(c->fmt_in, -1, stream_pos, 0);
  #endif
      /* set the start time (needed for maxtime and RTP packet timing) */



-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/



More information about the ffmpeg-devel mailing list