After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691462 - typefind: ADTS/AAC wrongly detected as MP2
typefind: ADTS/AAC wrongly detected as MP2
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.1.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-01-10 09:12 UTC by yang.jie
Modified: 2015-12-28 10:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
adts aac file. (180.23 KB, audio/vnd.dlna.adts)
2013-01-10 09:14 UTC, yang.jie
  Details
fix the aac type find issue. (3.61 KB, patch)
2013-08-14 08:59 UTC, yang.jie
needs-work Details | Review
fix the aac type find issue. (2.81 KB, patch)
2013-08-14 15:30 UTC, yang.jie
needs-work Details | Review
fix the aac type find issue. (2.97 KB, patch)
2013-08-15 08:38 UTC, yang.jie
committed Details | Review

Description yang.jie 2013-01-10 09:12:32 UTC
with the attach aac(adts) file, type find component recognized it as MP2 with 85%, and recognized as adts with only 80%. then, when try to play it, failed.

meida type audio/mpeg, mpegversion=(int)1, layer=(int)2 found, probability 85% / 1
Comment 1 yang.jie 2013-01-10 09:14:52 UTC
Created attachment 233141 [details]
adts aac file.

here come with the aac file.
Comment 2 Edward Hervey 2013-08-14 06:02:54 UTC
Yang, you've set the status of this bug to ASSIGNED. Do you intend to work on it ? There's been no news for 7 months.
Comment 3 yang.jie 2013-08-14 06:57:46 UTC
(In reply to comment #2)
> Yang, you've set the status of this bug to ASSIGNED. Do you intend to work on
> it ? There's been no news for 7 months.

Edward, I tried work on it before, but only find workaround for it, so not submit the patch. seems nobody can duplicate it?
Comment 4 Edward Hervey 2013-08-14 08:00:14 UTC
The issue still exists in current master.
Comment 5 yang.jie 2013-08-14 08:02:17 UTC
(In reply to comment #4)
> The issue still exists in current master.

OK, I will submit my patch soon.
Comment 6 yang.jie 2013-08-14 08:59:53 UTC
Created attachment 251583 [details] [review]
fix the aac type find issue.

fix typefind ADTS/AAC wrongly detected as MP2 issue.
Comment 7 yang.jie 2013-08-14 09:00:38 UTC
(In reply to comment #4)
> The issue still exists in current master.

Edward, can you help verified if it can fix the issue from your side?
Comment 8 Sebastian Dröge (slomo) 2013-08-14 09:14:52 UTC
Review of attachment 251583 [details] [review]:

Can you attach this in "git format-patch" format?

::: gst/typefind/gsttypefindfunctions.c
@@ +1036,3 @@
+        offset += len;
+
+        /* find more aac sync to select correctly */

I think it would be better to move this into a loop instead of duplicating the same code 3 times. Also I think if we found that many frames in the correct distances it is safe to give maximum probability :)
Comment 9 yang.jie 2013-08-14 15:30:03 UTC
Created attachment 251622 [details] [review]
fix the aac type find issue.

git format-patch
Comment 10 yang.jie 2013-08-14 15:31:16 UTC
(In reply to comment #8)
> Review of attachment 251583 [details] [review]:
> Can you attach this in "git format-patch" format?
> ::: gst/typefind/gsttypefindfunctions.c
> @@ +1036,3 @@
> +        offset += len;
> +
> +        /* find more aac sync to select correctly */
> I think it would be better to move this into a loop instead of duplicating the
> same code 3 times. Also I think if we found that many frames in the correct
> distances it is safe to give maximum probability :)

Sebastian, you are right. new patch as attached.
Comment 11 Sebastian Dröge (slomo) 2013-08-15 08:13:10 UTC
Review of attachment 251622 [details] [review]:

::: gst/typefind/gsttypefindfunctions.c
@@ +1085,3 @@
         }
 
         gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, caps);

Just call gst_type_find_suggest() once in the end and not for every single try

@@ +1104,3 @@
+              (c.data[offset + 4] << 3) | ((c.data[offset + 5] & 0xe0) >> 5);
+          if (len == 0 || !data_scan_ctx_ensure_data (tf, &c, len + 2)) {
+            GST_DEBUG ("Wrong sync or next frame not within reach, len=%u", len);

I'd say if not enough data is available you should not goto next but return whatever probability you have accumulated so far

@@ +1109,3 @@
+          snc = GST_READ_UINT16_BE (c.data + offset);
+          if ((snc & 0xfff6) == 0xfff0) {
+            gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 5 * (i - 2), caps);

Same here
Comment 12 yang.jie 2013-08-15 08:38:08 UTC
Created attachment 251698 [details] [review]
fix the aac type find issue.

patch updated.
Comment 13 yang.jie 2013-08-15 08:40:14 UTC
(In reply to comment #11)
> Review of attachment 251622 [details] [review]:
> ::: gst/typefind/gsttypefindfunctions.c
> @@ +1085,3 @@
>          }
>          gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, caps);
> Just call gst_type_find_suggest() once in the end and not for every single try
> @@ +1104,3 @@
> +              (c.data[offset + 4] << 3) | ((c.data[offset + 5] & 0xe0) >> 5);
> +          if (len == 0 || !data_scan_ctx_ensure_data (tf, &c, len + 2)) {
> +            GST_DEBUG ("Wrong sync or next frame not within reach, len=%u",
> len);
> I'd say if not enough data is available you should not goto next but return
> whatever probability you have accumulated so far
> @@ +1109,3 @@
> +          snc = GST_READ_UINT16_BE (c.data + offset);
> +          if ((snc & 0xfff6) == 0xfff0) {
> +            gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 5 * (i - 2),
> caps);
> Same here

good suggestion, patch updated.
Comment 14 Sebastian Dröge (slomo) 2013-08-15 08:41:30 UTC
commit e933fadf8ca2f3d19a5a54b3a3c376fc2db0fe58
Author: Jie Yang <yang.jie@intel.com>
Date:   Thu Aug 15 16:12:45 2013 +0800

    typefind: ADTS/AAC, find more aac sync to select correctly
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691462
Comment 15 Sebastian Dröge (slomo) 2015-12-28 10:30:50 UTC
This introduced a crash, see bug #759910