[FFmpeg-cvslog] ffmpeg: Check that r_frame_rate is set before attempting to use it

Michael Niedermayer git at videolan.org
Sun Jun 5 03:16:42 CEST 2016


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Mon May 16 12:49:06 2016 +0200| [ed71759fd08b1b2c4760c5bc973318c534dc346a] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 6085d6b2aeef28671614f625601a23cfc922d282)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 ffmpeg.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a5ec3c3..9352b24 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2893,7 +2893,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



More information about the ffmpeg-cvslog mailing list