typefind: Fix identification of some MPEG files
authorReynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Thu, 14 Nov 2013 04:53:31 +0000 (01:53 -0300)
committerReynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Fri, 15 Nov 2013 02:46:12 +0000 (23:46 -0300)
Make sure we begin by peeking at MPEG2_MAX_PROBE_LENGTH
bytes.

Fixes:

https://bugzilla.gnome.org/show_bug.cgi?id=678011

gst/typefind/gsttypefindfunctions.c

index 5126efb..14c679a 100644 (file)
@@ -2178,10 +2178,13 @@ mpeg_sys_type_find (GstTypeFind * tf, gpointer unused)
     gint len;
 
     len = MPEG2_MAX_PROBE_LENGTH;
-    do {
-      len = len / 2;
+
+    while (len >= 16) {
       data = gst_type_find_peek (tf, 0, 5 + len);
-    } while (data == NULL && len >= 32);
+      if (data != NULL)
+        break;
+      len = len / 2;
+    }
 
     if (!data)
       return;