From dd7b219c4223a317516ed8d597c1ad56b52a8b68 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 8 Feb 2011 12:17:53 +0200 Subject: [PATCH] ffmpeg: don't divide by 0 when checking the framerates Check for denom==0 first and set it to on in that case. --- ext/ffmpeg/gstffmpegcodecmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index de3bd5f058..23776e571e 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -204,6 +204,10 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id, num = context->time_base.den / context->ticks_per_frame; denom = context->time_base.num; + if (!denom) { + GST_LOG ("invalid framerate: %d/0, -> %d/1", num, num); + denom = 1; + } if (gst_util_fraction_compare (num, denom, 1000, 1) > 0) { GST_LOG ("excessive framerate: %d/%d, -> 0/1", num, denom); num = 0;