[FFmpeg-devel] [PATCH] lavf/utils: update stream duration only if it is not set or 0
Matthieu Bouron
matthieu.bouron at gmail.com
Mon Jul 3 15:02:24 EEST 2017
---
The following patch makes lavf/utils only update stream duration only if it is
not set or 0 in fill_all_stream_timings (which is called by
avformat_find_stream_info).
In the context of mov demuxing, the patch makes the last packet duration the
same as the one declared in the stts table for example (ie: we trust what the
demuxer reports).
The patch passes fate, however it might not be valid but I would like to
understand what is the purpose / use-case of the update_stream_timing /
fill_all_stream_timings functions which are not too well documented.
Thanks.
---
libavformat/utils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 38d247c6cd..00adf026e6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2654,7 +2654,8 @@ static void fill_all_stream_timings(AVFormatContext *ic)
if (ic->start_time != AV_NOPTS_VALUE)
st->start_time = av_rescale_q(ic->start_time, AV_TIME_BASE_Q,
st->time_base);
- if (ic->duration != AV_NOPTS_VALUE)
+ if (ic->duration != AV_NOPTS_VALUE &&
+ (st->duration == 0 || st->duration == AV_NOPTS_VALUE))
st->duration = av_rescale_q(ic->duration, AV_TIME_BASE_Q,
st->time_base);
}
--
2.13.2
More information about the ffmpeg-devel
mailing list