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 781135 - aacparse: incorrect sampling rate in ADTS header for SBR streams
aacparse: incorrect sampling rate in ADTS header for SBR streams
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-10 13:44 UTC by A Ashley
Modified: 2018-11-03 15:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example SBR AAC file (3.47 MB, application/octet-stream)
2017-04-10 13:46 UTC, A Ashley
  Details
aacparse: use base sampling frequency for ADTS header with SBR AAC streams (7.28 KB, patch)
2017-04-10 13:54 UTC, A Ashley
none Details | Review
aacparse: use base sampling frequency in ADTS header for SBR AAC streams (7.46 KB, patch)
2017-04-11 09:39 UTC, A Ashley
none Details | Review
aacparse: use base sampling frequency in ADTS header for SBR AAC streams (7.86 KB, patch)
2017-04-19 13:25 UTC, A Ashley
none Details | Review
tests: aacparse: add test for ADTS header generation for HE-AAC stream (6.18 KB, patch)
2017-04-19 13:27 UTC, A Ashley
none Details | Review

Description A Ashley 2017-04-10 13:44:10 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.
Comment 1 A Ashley 2017-04-10 13:46:43 UTC
Created attachment 349607 [details]
Example SBR AAC file
Comment 2 A Ashley 2017-04-10 13:54:26 UTC
Created attachment 349611 [details] [review]
aacparse: use base sampling frequency for ADTS header with SBR AAC streams
Comment 3 A Ashley 2017-04-10 13:59:39 UTC
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).
Comment 4 Edward Hervey 2017-04-11 08:09:07 UTC
Could you rebase against current master ? Changes went in last week.
Comment 5 A Ashley 2017-04-11 09:39:52 UTC
Created attachment 349662 [details] [review]
aacparse: use base sampling frequency in ADTS header for SBR AAC streams

Rebased to master
Comment 6 A Ashley 2017-04-19 13:25:33 UTC
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.
Comment 7 A Ashley 2017-04-19 13:27:07 UTC
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
Comment 8 GStreamer system administrator 2018-11-03 15:18:09 UTC
-- 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.