From 1de99a2a81da913f9a03433a680be72c229362c1 Mon Sep 17 00:00:00 2001 From: Mikhal Shemer Date: Tue, 1 Mar 2011 14:59:22 -0800 Subject: [PATCH] Fixing divide by zero Change-Id: I9d8a98a2f7ed1e3116d0bae35164618c41998bac --- vp8/encoder/onyx_if.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 5dc579d10..39610a73f 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -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); + } }