[FFmpeg-devel] [PATCH, V2] avformat/concat: Fix wrong wrapped timestamp

Nicolas George george at nsup.org
Sun Dec 17 16:55:50 EET 2017


mymoeyard at gmail.com (2017-12-14):
> From: Wu Zhiqiang <mymoeyard at gmail.com>
> 
> When using concat protocol, start from middle of file will generate non-zero wrap reference.
> If seek to time before the wrap reference, wrap control will generate wrong wrapped timestamp.
> Copy wrap related stream properties when reading header can fix this problem.
> 
> Signed-off-by: Wu Zhiqiang <mymoeyard at gmail.com>
> ---
>  libavformat/concatdec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index 0e189012ad..8dae2737df 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -188,6 +188,11 @@ static int copy_stream_props(AVStream *st, AVStream *source_st)
>      st->time_base           = source_st->time_base;
>      st->sample_aspect_ratio = source_st->sample_aspect_ratio;
>  
> +    /* Fix wrap control problem */
> +    avpriv_set_pts_info(st, source_st->pts_wrap_bits, source_st->time_base.num, source_st->time_base.den);
> +    st->pts_wrap_behavior   = source_st->pts_wrap_behavior;
> +    st->pts_wrap_reference  = source_st->pts_wrap_reference;
> +
>      av_dict_copy(&st->metadata, source_st->metadata, 0);
>      return 0;
>  }

The concat demuxer is mine to maintain, but I am not very familiar with
the wrapped timestamps handling, and the commit message does not
enlighten me.

(By the way, please wrap it at 60-70 characters.)

The way I see it, if the library takes care of de-wrapping timestamps,
then the concat demuxer will see de-wrapped timestamps from the
underlying demuxer, and the timestamps do not need to be de-wrapped a
second time: setting the wrap information is unnecessary and even wrong.

Please explain what I am missing.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171217/67d401a4/attachment.sig>


More information about the ffmpeg-devel mailing list