changeset 5089:a8f6dd9abf72 libavformat

Replace invalid Theora frame rate by 25 FPS. Avoids division by 0 due to e.g. time_base denominator being 0.
author reimar
date Fri, 03 Jul 2009 11:31:09 +0000
parents 5da0e7ccc3c4
children f2671cc3467c
files oggparsetheora.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/oggparsetheora.c	Fri Jul 03 11:27:52 2009 +0000
+++ b/oggparsetheora.c	Fri Jul 03 11:31:09 2009 +0000
@@ -86,6 +86,11 @@
         }
         st->codec->time_base.den = get_bits_long(&gb, 32);
         st->codec->time_base.num = get_bits_long(&gb, 32);
+        if (!(st->codec->time_base.num > 0 && st->codec->time_base.den > 0)) {
+            av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n");
+            st->codec->time_base.num = 1;
+            st->codec->time_base.den = 25;
+        }
         st->time_base = st->codec->time_base;
 
         st->sample_aspect_ratio.num = get_bits_long(&gb, 24);