Bug#843173: libfaad-dev: Implicit SBR detection via AudioSpecificConfig fails when char is signed

Stefan Pöschel stefan.poeschel at gmx.de
Fri Nov 4 15:18:50 UTC 2016


Package: libfaad-dev
Version: 2.7-8
Severity: normal

I'm not sure if this an issue which affects Debian itself. As it affects FAAD2
users and the development seems (the original homepage is orphaned) to be
continued within a Debian Git repo, I post it here.


FAAD2 provides the ability to init the decoder with the help of an AudioSpecificConfig
bit sequence (see also ISO/IEC 14496-3) via NeAACDecInit2. That function also
returns the "output" sample rate of the AAC stream.

When the AAC stream has the SBR extension (therefore: the core sample rate is
the half of the output sample rate), this can be signalled implicitely. In this
case the AudioSpecificConfig signals e.g. 24 kHz. FAAD2 treats streams with
sample rates of 24 kHz (or lower) automatically as having the SBR extension
(see the end of AudioSpecificConfigFromBitfile in /libfaad/mp4.c) and the
double of the core sample rate is returned as output sample rate.

Unfortunately, this does not work on systems where the char data type is
unsigned (e.g. Raspbian Jessie). In this case, the variable
mp4ASC->sbr_present_flag in the mentioned function
AudioSpecificConfigFromBitfile does not get initialized to -1. Therefore the
sample rate returned by NeAACDecInit2 is not doubled and still refers to the
core sample rate instead of the output sample rate.


The problem affects the installed version (see below) as well as the latest Git
version from git://anonscm.debian.org/pkg-multimedia/faad2.git

One way to fix this is to make the struct variable sbr_present_flag signed.
Another way is to enforce signed char by compiling FAAD2 with -fsigned-char.

I attach a short example in C which reproduces the problem. It prints out the
expected vs. the returned sample rate.

-- System Information:
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 8.0 (jessie)
Release:	8.0
Codename:	jessie
Architecture: armv7l

Kernel: Linux 4.4.21-v7+ (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libfaad-dev depends on:
ii  libfaad2  2.7-8

libfaad-dev recommends no packages.

libfaad-dev suggests no packages.

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: faad2_test.c
Type: text/x-csrc
Size: 1234 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/attachments/20161104/85933482/attachment.c>


More information about the pkg-multimedia-maintainers mailing list