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

Submitted by mymoeyard@gmail.com on Dec. 29, 2017, 11:10 a.m.

Details

Message ID 1514545850-24529-1-git-send-email-mymoeyard@gmail.com
State New
Headers show

Commit Message

mymoeyard@gmail.com Dec. 29, 2017, 11:10 a.m.
From: Wu Zhiqiang <mymoeyard@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@gmail.com>
---
 libavformat/concatdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Nicolas George Dec. 29, 2017, 11:33 a.m.
mymoeyard@gmail.com (2017-12-29):
> From: Wu Zhiqiang <mymoeyard@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@gmail.com>

You did not answer to this mail:

https://ffmpeg.org/pipermail/ffmpeg-devel/2017-December/222549.html

Regards,
mymoeyard@gmail.com Dec. 29, 2017, 11:54 a.m.
I already answered:

http://ffmpeg.org/pipermail/ffmpeg-devel/2017-December/222605.html

<http://ffmpeg.org/pipermail/ffmpeg-devel/2017-December/222605.html>
I just refine coding style following your advice and re-submit it.

Thanks.

On Fri, Dec 29, 2017 at 7:33 PM, Nicolas George <george@nsup.org> wrote:

> mymoeyard@gmail.com (2017-12-29):
> > From: Wu Zhiqiang <mymoeyard@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@gmail.com>
>
> You did not answer to this mail:
>
> https://ffmpeg.org/pipermail/ffmpeg-devel/2017-December/222549.html
>
> Regards,
>
> --
>   Nicolas George
>

Patch hide | download patch | download mbox

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 0e189012ad..8ea9c2b02d 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -188,6 +188,12 @@  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;
 }