[FFmpeg-devel] [PATCH 3/3] Only set starttime to pts when pts and dts agree

Ivan Kalvachev ikalvachev
Wed Mar 2 18:55:22 CET 2011


On 3/2/11, Benjamin Larsson <banan at ludd.ltu.se> wrote:
> On 03/02/2011 06:32 PM, M?ns Rullg?rd wrote:
>> Benjamin Larsson <benjamin at southpole.se> writes:
>>
>>> ---
>>>  libavformat/utils.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>>> index c8e16ba..7627364 100644
>>> --- a/libavformat/utils.c
>>> +++ b/libavformat/utils.c
>>> @@ -872,7 +872,7 @@ static void update_initial_timestamps(AVFormatContext
>>> *s, int stream_index,
>>>              st->start_time= pktl->pkt.pts;
>>>      }
>>>      if (st->start_time == AV_NOPTS_VALUE)
>>> -        st->start_time = pts;
>>> +        st->start_time = pts==dts ? pts : AV_NOPTS_VALUE;
>>>  }
>>>
>>>  static void update_initial_durations(AVFormatContext *s, AVStream *st,
>>> AVPacket *pkt)
>>> --
>>> 1.7.1
>> What is this intended to fix?  Why should this be done only if pts and
>> dts are equal, i.e. no decoder delay?
>
> mpeg 2 mov file duration gets messed up when the files starts with a b
> frame.
>
> pts in the file is 200,0, etc.
>
> MvH
> Benjamin Larsson
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>

How about:
-      if (st->start_time == AV_NOPTS_VALUE)
+      if (st->start_time == AV_NOPTS_VALUE && pts ==dts )
         st->start_time = pts;

?



More information about the ffmpeg-devel mailing list