From e88f9e63ee384b1f587f2ad263361ea62d747f8c Mon Sep 17 00:00:00 2001
From: James Zern <jzern@google.com>
Date: Tue, 1 Nov 2011 13:44:00 -0700
Subject: [PATCH] vpxenc: fix crash w/empty input file

Fixes issue #362.

Change-Id: Iba6d7e49ed610b44c8a4c0f3d6330a93feb0373d
---
 vpxenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vpxenc.c b/vpxenc.c
index 56eff600da..abbf093a9a 100644
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -2068,11 +2068,11 @@ int main(int argc, const char **argv_)
                "\rPass %d/%d frame %4d/%-4d %7"PRId64"B %7lub/f %7"PRId64"b/s"
                " %7lu %s (%.2f fps)\033[K", pass + 1,
                arg_passes, frames_in, frames_out, nbytes,
-               (unsigned long)(nbytes * 8 / frames_in),
-               nbytes * 8 *(int64_t)arg_framerate.num / arg_framerate.den / frames_in,
+               frames_in ? (unsigned long)(nbytes * 8 / frames_in) : 0,
+               frames_in ? nbytes * 8 *(int64_t)arg_framerate.num / arg_framerate.den / frames_in : 0,
                cx_time > 9999999 ? cx_time / 1000 : cx_time,
                cx_time > 9999999 ? "ms" : "us",
-               (float)frames_in * 1000000.0 / (float)cx_time);
+               cx_time > 0 ? (float)frames_in * 1000000.0 / (float)cx_time : 0);
 
         if ( (show_psnr) && (psnr_count>0) )
         {
-- 
GitLab