GNOME Bugzilla – Bug 691462
typefind: ADTS/AAC wrongly detected as MP2
Last modified: 2015-12-28 10:30:50 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
Created attachment 233141 [details] adts aac file. here come with the aac file.
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.
(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?
The issue still exists in current master.
(In reply to comment #4) > The issue still exists in current master. OK, I will submit my patch soon.
Created attachment 251583 [details] [review] fix the aac type find issue. fix typefind ADTS/AAC wrongly detected as MP2 issue.
(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?
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 :)
Created attachment 251622 [details] [review] fix the aac type find issue. git format-patch
(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.
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
Created attachment 251698 [details] [review] fix the aac type find issue. patch updated.
(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.
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
This introduced a crash, see bug #759910