vpxdec: Fix webm fps check.
authorFrank Galligan <fgalligan@google.com>
Thu, 24 Oct 2013 17:33:24 +0000 (10:33 -0700)
committerFrank Galligan <fgalligan@google.com>
Thu, 24 Oct 2013 17:37:14 +0000 (10:37 -0700)
If the webm file did not have a Cues then vpxdec would fail
when creating a y4m file. If there is no Cues element print
out a warning and set fps to 30.

Change-Id: Ieea7040265dfdac7dff4ccf917c6f756160a96bc

vpxdec.c

index 513d7bd..1860474 100644 (file)
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -501,6 +501,15 @@ webm_guess_framerate(struct input_ctx *input,
   unsigned int i;
   uint64_t     tstamp = 0;
 
+  /* Check to see if we can seek before we parse any data. */
+  if (nestegg_track_seek(input->nestegg_ctx, input->video_track, 0)) {
+    fprintf(stderr,
+            "WARNING: Failed to guess framerate (no Cues), set to 30fps.\n");
+    *fps_num = 30;
+    *fps_den = 1;
+    return 0;
+  }
+
   /* Guess the framerate. Read up to 1 second, or 50 video packets,
    * whichever comes first.
    */