changeset 6471:b3aea89a4f63 libavformat

nutenc: fix unstable floating-point calculations
author mru
date Fri, 10 Sep 2010 13:16:08 +0000
parents 5d5fbab4d608
children ae4ea19af762
files nutenc.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nutenc.c	Thu Sep 09 23:15:17 2010 +0000
+++ b/nutenc.c	Fri Sep 10 13:16:08 2010 +0000
@@ -561,11 +561,11 @@
         if(j==nut->time_base_count)
             nut->time_base_count++;
 
-        if(av_q2d(time_base) >= 0.001)
+        if(INT64_C(1000) * time_base.num >= time_base.den)
             nut->stream[i].msb_pts_shift = 7;
         else
             nut->stream[i].msb_pts_shift = 14;
-        nut->stream[i].max_pts_distance= FFMAX(1/av_q2d(time_base), 1);
+        nut->stream[i].max_pts_distance= FFMAX(time_base.den, time_base.num) / time_base.num;
     }
 
     nut->max_distance = MAX_DISTANCE;