aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-16 12:49:06 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-16 14:23:49 +0200
commit6085d6b2aeef28671614f625601a23cfc922d282 (patch)
treec228f36f7bb85bbe174ba941290787765460705b /ffmpeg.c
parentfeeb3a92616310b5f79191b0ef3064712c40b7d3 (diff)
downloadffmpeg-6085d6b2aeef28671614f625601a23cfc922d282.tar.gz
ffmpeg: Check that r_frame_rate is set before attempting to use it
Avoids unexpected occurance and dependency on NaN behavior and divisions by 0 Testcase: fate-lavf-fate-avi_cram Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 002705ac2c..7c60075fa4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2917,7 +2917,8 @@ static int transcode_init(void)
* overhead
*/
if(!strcmp(oc->oformat->name, "avi")) {
- if ( copy_tb<0 && av_q2d(ist->st->r_frame_rate) >= av_q2d(ist->st->avg_frame_rate)
+ if ( copy_tb<0 && ist->st->r_frame_rate.num
+ && av_q2d(ist->st->r_frame_rate) >= av_q2d(ist->st->avg_frame_rate)
&& 0.5/av_q2d(ist->st->r_frame_rate) > av_q2d(ist->st->time_base)
&& 0.5/av_q2d(ist->st->r_frame_rate) > av_q2d(dec_ctx->time_base)
&& av_q2d(ist->st->time_base) < 1.0/500 && av_q2d(dec_ctx->time_base) < 1.0/500