[FFmpeg-devel] [PATCH] AAC: reject multiple channel configurations

Alex Converse alex.converse
Tue Jul 7 02:31:41 CEST 2009


Invalid second channel configurations are one of the biggest causes of
crashes in the AAC deocder in my experience. See issue 1254 for an
example. If they are even legal is dubious at best. From 14496-3:2005:

""" Program config element (PCE)
See ISO/IEC13818-7 (13818-7:2005, subclause 8.5 "Program Config Element (PCE)").

The following changes apply in the context of MPEG-4:

A program_config_element() may occur outside the AAC payload e. g. as
part of the GASpecificConfig() or the
adif_header(), but also inside the AAC payload as syntactic element in
a raw_data_block().

Note that the channel configuration given in a
program_config_element() inside the AAC payload is evaluated only,
if no channel configuration is given outside the AAC payload. In the
context of ISO/IEC 14496-3 this is only the
case for MPEG-4 ADTS with channel_configation==0.

In any case only one program may be configured at a certain time.

[...] Channel configuration
The AAC audio syntax provides three ways to convey the mapping of
channels within a set of syntactic elements to
physical locations of speakers. However in in the context of ISO/IEC
14496-3 only two of them are permitted. Explicit channel mapping using default channel settings
Default channel mappings are defined in subpart 1, Table 1.17 (values
larger 0). If MPEG-4 Audio is used together
with the MPEG-4 Systems audio compositor only these mappings shall be used. Explicit channel mapping using a program_config_element()
Any possible channel configuration can be specified using a
program_config_element().The same specifications
and restrictions as defined in ISO/IEC 13818-7 apply with respect to
the PCE when used in the context of
ISO/IEC 14496-3.

An MPEG-4 decoder is always required to parse any
program_config_element() inside the AAC payload. However,
the decoder is only required to evaluate it, if no channel
configuration is given outside the AAC payload. Implicit channel mapping
This kind of channel mapping as specified in ISO/IEC13818-7 is not
permitted in the context of ISO/IEC 14496-3.

Even if they are legal we aren't reliably able to handle them at the
moment so they should be disabled.

The attached patch does not break conformance.

You may be curious why the patch does not just error out completely.
It is clear from the spec that the redundant PCE must be parsed.
Erroring would break concatenation of compatible ADTS files that
contain a PCE.

Alex Converse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aac-ignore-second-pce.diff
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090706/03f22ad3/attachment.bin>

More information about the ffmpeg-devel mailing list