typefind: accept consecutive AC-3 frames of different sizes
authorRené Stadler <rene.stadler@nokia.com>
Fri, 3 Dec 2010 14:54:21 +0000 (16:54 +0200)
committerRené Stadler <rene.stadler@nokia.com>
Tue, 7 Dec 2010 19:28:20 +0000 (21:28 +0200)
This is perfectly valid and occurs in particular when there are
(in)dependent substreams present.

gst/typefind/gsttypefindfunctions.c

index 3bfd78a..84644ca 100644 (file)
@@ -1270,13 +1270,14 @@ ac3_type_find (GstTypeFind * tf, gpointer unused)
             data_scan_ctx_advance (tf, &c_next, frame_size * 2);
 
             if (c_next.data[0] == 0x0b && c_next.data[1] == 0x77) {
-              guint fscod2 = c_next.data[4] >> 6;
-              guint frmsizecod2 = c_next.data[4] & 0x3f;
+              fscod = c_next.data[4] >> 6;
+              frmsizecod = c_next.data[4] & 0x3f;
 
-              if (fscod == fscod2 && frmsizecod == frmsizecod2) {
+              if (fscod < 3 && frmsizecod < 38) {
                 GstTypeFindProbability prob;
 
-                GST_LOG ("found second AC3 frame, looks good");
+                GST_LOG ("found second AC3 frame (size=%u), looks good",
+                    ac3_frmsizecod_tbl[frmsizecod].frm_size[fscod]);
                 if (c.offset == 0)
                   prob = GST_TYPE_FIND_MAXIMUM;
                 else