[Bf-blender-cvs] [a542425] master: FFmpeg: Fix off by one error in number of detected frames in matroska container

Sergey Sharybin noreply at git.blender.org
Wed Oct 12 16:18:42 CEST 2016


Commit: a54242503e3fd50dcd4d3af8b39e1d2a6e138e45
Author: Sergey Sharybin
Date:   Wed Oct 12 16:17:43 2016 +0200
Branches: master
https://developer.blender.org/rBa54242503e3fd50dcd4d3af8b39e1d2a6e138e45

FFmpeg: Fix off by one error in number of detected frames in matroska container

Seems to be rounding error. Hopefully new code handles the error fixed back in
SVN revision 28901 and still have proper frame number for Hjalti.

What could possibly go wrong here..

===================================================================

M	source/blender/imbuf/intern/anim_movie.c

===================================================================

diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index d378ca9..a40b257 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -522,9 +522,9 @@ static int startffmpeg(struct anim *anim)
 		anim->duration = pFormatCtx->streams[videoStream]->nb_frames;
 	}
 	else {
-		anim->duration = ceil(pFormatCtx->duration *
-		                      av_q2d(frame_rate) /
-		                      AV_TIME_BASE);
+		anim->duration = (int)(pFormatCtx->duration *
+		                       av_q2d(frame_rate) /
+		                       AV_TIME_BASE + 0.5f);
 	}
 
 	frs_num = frame_rate.num;




More information about the Bf-blender-cvs mailing list