Fixing divide by zero
authorMikhal Shemer <mikhal@google.com>
Tue, 1 Mar 2011 22:59:22 +0000 (14:59 -0800)
committerMikhal Shemer <mikhal@google.com>
Thu, 3 Mar 2011 18:33:36 +0000 (10:33 -0800)
Change-Id: I9d8a98a2f7ed1e3116d0bae35164618c41998bac

vp8/encoder/onyx_if.c

index 5dc579d..39610a7 100644 (file)
@@ -5214,9 +5214,12 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
         {
             long long nanosecs = cpi->source_end_time_stamp
                 - cpi->last_end_time_stamp_seen;
-            double this_fps = 10000000.000 / nanosecs;
 
-            vp8_new_frame_rate(cpi, (7 * cpi->oxcf.frame_rate + this_fps) / 8);
+            if (nanosecs > 0)
+            {
+              double this_fps = 10000000.000 / nanosecs;
+              vp8_new_frame_rate(cpi, (7 * cpi->oxcf.frame_rate + this_fps) / 8);
+            }
 
         }