GNOME Bugzilla – Bug 781135
aacparse: incorrect sampling rate in ADTS header for SBR streams
Last modified: 2018-11-03 15:18:09 UTC
An HE-AAC stream contains an AAC-LC stream that uses a given sampling frequency combined with an AAC-SBR enhancement layer that is used to double the sampling frequency of the AAC-LC layer. When generating ADTS headers, the sampling frequency of the AAC-LC stream should be used, so that AAC decoders that only understand the LC layer can correctly decode them. Currently aacparse is using the extended sampling rate (either from caps or parsing LOAS) when generating the ADTS header. For example an HE-AAC stream that contains a 24KHz AAC-LC stream plus SBR data to convert it to 48KHz should have the sampling frequency index field of the ADTS header set to 24KHz (to match the AAC-LC stream) but currently it is being set to 48KHz. This causes the stream to fail to decode.
Created attachment 349607 [details] Example SBR AAC file
Created attachment 349611 [details] [review] aacparse: use base sampling frequency for ADTS header with SBR AAC streams
To test the patch, you can use the following command: gst-launch-1.0 -m filesrc location=HEAAC_96K.m4a ! qtdemux ! aacparse ! "audio/mpeg, stream-format=adts" ! identity silent=false dump=true ! fakesink The start of each GstBuffer is the 7 bytes of the ADTS header. The first three bytes should be 0xFF 0xF1 0x58 (which is 24KHz in the sample rate index field). However without the patch, the value is 0xFF 0xF1 0x4e (which is 48KHz).
Could you rebase against current master ? Changes went in last week.
Created attachment 349662 [details] [review] aacparse: use base sampling frequency in ADTS header for SBR AAC streams Rebased to master
Created attachment 350070 [details] [review] aacparse: use base sampling frequency in ADTS header for SBR AAC streams Change to gst_aac_parse_read_audio_specific_config() prototype was missing from previous patch.
Created attachment 350071 [details] [review] tests: aacparse: add test for ADTS header generation for HE-AAC stream Created a unit test for checking generation of ADTS header
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/363.