]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/oggparsetheora.c
Print extradata in case of failure. I had this in my local tree and it
[ffmpeg] / libavformat / oggparsetheora.c
index 96c432f9930bc37c3fe25f2c3756923141ec5cb8..0d74116d178822d656b63e4711bc648797ad513b 100644 (file)
@@ -86,6 +86,11 @@ theora_header (AVFormatContext * s, int idx)
         }
         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);
@@ -106,7 +111,8 @@ theora_header (AVFormatContext * s, int idx)
         vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8);
     }
 
-    st->codec->extradata = av_realloc (st->codec->extradata, cds);
+    st->codec->extradata = av_realloc (st->codec->extradata,
+                                       cds + FF_INPUT_BUFFER_PADDING_SIZE);
     cdp = st->codec->extradata + st->codec->extradata_size;
     *cdp++ = os->psize >> 8;
     *cdp++ = os->psize & 0xff;