GNOME Bugzilla – Bug 735520
aacparse: skip valid ADTS/LOAS frames
Last modified: 2014-09-04 09:55:42 UTC
When parsing an incomplete ADTS/LOAS frame, the first byte of this frame is skipped which make the frame invalid. In the function gst_aac_parse_handle_frame, if gst_aac_parse_check_adts_frame returns FALSE with needed data > 0, skipsize remains -1. If skipsize == -1, skipsize becomes 1 to skip the first byte (still needed). See the attached patch that fix the issue.
Created attachment 284602 [details] [review] fix skip frame issue
Can you provide a sample stream that shows this behaviour? And also please attach the patch in "git format-patch" format, including a descriptive commit message and having your name and mail address set up in the git config :)
I do not wish to publish the stream (72 MB). I can sent it to you directly. I will provide a new patch.
Just attaching the relevant part of the file should also be enough already. And please convert the patch to "git format-patch" format.
Created attachment 284981 [details] [review] fix parsing ADTS/LOAS issue
I tried to dump the AAC stream only. But with this dump, I am unable to reproduced the issue. I manage to reproduce with the full .TS file only.
Could you attach the first 1MB of the .ts file then perhaps? (assuming it reproduces the issue) Or you could try do do ... ! tsdemux ! audio/mpeg ! gdppay ! filesink location=aac.gdp
Created attachment 284996 [details] aac stream
Thanks very much Tim. I did not know gdp. To use this stream, you will need also to have the patch included in https://bugzilla.gnome.org/show_bug.cgi?id=721697 gst-launch-1.0 -v --gst-debug=aacparse:6 filesrc location= aac.gdp ! gdpdepay ! aacparse ! fakesink silent=false Running without the patch (the first 3 discont are expected): /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (266 bytes, dts: 0:00:00.420391444, pts: 0:00:00.420391444, duration: 0:00:00.042666666, offset: 250, offset_end: -1, flags: 00000040 discont ) 0x75e05aa8 ... /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (262 bytes, dts: 0:00:02.639058111, pts: 0:00:02.724391443, duration: 0:00:00.042666666, offset: 14290, offset_end: -1, flags: 00000040 discont ) 0x75e05dc8 /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (258 bytes, dts: 0:00:03.682009184, pts: 0:00:03.682009184, duration: 0:00:00.042666666, offset: 14586, offset_end: -1, flags: 00000040 discont ) 0x75e05aa8 ... /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (238 bytes, dts: 0:00:15.202009184, pts: 0:00:15.202009184, duration: 0:00:00.042666666, offset: 83752, offset_end: -1, flags: 00000040 discont ) 0x75e05a08 ... /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (248 bytes, dts: 0:00:17.463342517, pts: 0:00:17.463342517, duration: 0:00:00.042666666, offset: 97456, offset_end: -1, flags: 00000040 discont ) 0x75e058c8 ... /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (264 bytes, dts: 0:00:31.756675851, pts: 0:00:31.756675851, duration: 0:00:00.042666666, offset: 183164, offset_end: -1, flags: 00000040 discont ) 0x75e05dc8 Running it with the patch: /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (266 bytes, dts: 0:00:00.420391444, pts: 0:00:00.420391444, duration: 0:00:00.042666666, offset: 250, offset_end: -1, flags: 00000040 discont ) 0x756062b8 ... /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (262 bytes, dts: 0:00:02.639058111, pts: 0:00:02.724391443, duration: 0:00:00.042666666, offset: 14290, offset_end: -1, flags: 00000040 discont ) 0x756065d8 /GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain ******* (fakesink0:sink) (258 bytes, dts: 0:00:03.682009184, pts: 0:00:03.682009184, duration: 0:00:00.042666666, offset: 14586, offset_end: -1, flags: 00000040 discont ) 0x756062b8
commit 15894c1853bd26147a7608d3b0a85d9f3015494c Author: Nicolas Huet <nicolas.huet@parrot.com> Date: Mon Sep 1 09:56:02 2014 +0200 aacparse: Fix parsing issue when the buffer does not have a complete ADTS/LOAS frame https://bugzilla.gnome.org/show_bug.cgi?id=735520