typefindfunctions: made mp3_type_find less aggressive
authorArnout Vandecappelle <arnout@mind.be>
Thu, 7 May 2009 12:59:36 +0000 (14:59 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 12 May 2009 07:03:22 +0000 (09:03 +0200)
mp3_type_find could suggest already when only a single valid header
was found, if it ran out of data before the end of the next frame.
Therefore, ignore the last found frame if it was incomplete.
Fixes bug #579692.

gst/typefind/gsttypefindfunctions.c

index 822ade0..ad010d0 100644 (file)
@@ -931,6 +931,10 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
         offset += length;
       }
       g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS);
+      if (head_data == NULL &&
+          gst_type_find_peek (tf, offset + start_off - 1, 1) == NULL)
+        /* Incomplete last frame - don't count it. */
+        found--;
       if (found == GST_MP3_TYPEFIND_TRY_HEADERS ||
           (found >= GST_MP3_TYPEFIND_MIN_HEADERS && head_data == NULL)) {
         /* we can make a valid guess */