[FFmpeg-cvslog] lavf: Dont compare absolute to relative timestamps in duration gcd

Michael Niedermayer git at videolan.org
Fri Nov 9 15:00:10 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov  9 14:54:43 2012 +0100| [7ec1fe1f472c2fb1cf0e0b2b89e107a08ac7efe5] | committer: Michael Niedermayer

lavf: Dont compare absolute to relative timestamps in duration gcd

This prevents a division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ec1fe1f472c2fb1cf0e0b2b89e107a08ac7efe5
---

 libavformat/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1c5614f..0240b0c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2729,7 +2729,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                 }
                 st->info->duration_count++;
                 // ignore the first 4 values, they might have some random jitter
-                if (st->info->duration_count > 3)
+                if (st->info->duration_count > 3 && is_relative(pkt->dts) == is_relative(last))
                     st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration);
             }
             if (pkt->dts != AV_NOPTS_VALUE)



More information about the ffmpeg-cvslog mailing list