AAC ADTS: channel_configuration == 7 means 7.1 = 8 channels

See ISO/IEC 14496-3 table 1.17 — Channel Configuration.

Fixes #2151.
This commit is contained in:
Moritz Bunkus 2017-11-17 19:31:53 +01:00
parent 6d156cab3f
commit 0ee2d21708
4 changed files with 24 additions and 1 deletions

View File

@ -25,6 +25,9 @@
automatically anymore whenever the segment info section is edited and the
`date` element is either deleted or not present in the first place. Fixes
#2143.
* mkvmerge: AAC ADTS parser: fixed interpretation of the
`channel_configuration` header element for ADTS files that do not contain a
program configuration element: value 7 means 7.1 channels. Fixes #2151.
# Version 17.0.0 "Be Ur Friend" 2017-10-14

View File

@ -26,12 +26,18 @@
namespace mtx { namespace aac {
// See ISO/IEC 14496-3, table 1.16 — Sampling Frequency Index
static unsigned int const s_sampling_freq[16] = {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000,
7350, 0, 0, 0 // filling
};
// See ISO/IEC 14496-3, table 1.17 — Channel Configuration
static unsigned int const s_adts_channels[8] = {
0, 1, 2, 3, 4, 5, 6, 8,
};
static debugging_option_c s_debug_parse_data{"aac_parse_audio_specific_config|aac_full"};
unsigned int
@ -540,7 +546,7 @@ parser_c::decode_adts_header(unsigned char const *buffer,
frame.m_header.config.profile = bc.get_bits(2);
int sfreq_index = bc.get_bits(4);
bc.skip_bits(1); // private
frame.m_header.config.channels = bc.get_bits(3);
frame.m_header.config.channels = s_adts_channels[bc.get_bits(3)];
bc.skip_bits(1 + 1); // original/copy & home
bc.skip_bits(1 + 1); // copyright_id_bit & copyright_id_start

View File

@ -467,3 +467,4 @@ T_618e_ac_3_with_core_and_extensions_in_different_blocks:ec4879f47904cc21476dbc5
T_619ac_3_misdetected_as_mpeg_ps_and_encrypted:795e9be4c1601e9853378a1fee1bfd01:passed:20171007-172620:0.015403278
T_620ac3_incomplete_frame_with_timestamp_from_matroska:b2fa8c28c5a45d40460905464e3a3d5f:passed:20171014-153427:0.397688103
T_621propedit_remove_date:fdfebfa48bbd5fc21088827b0ad8f616-ok:passed:20171101-180348:0.062479826
T_622aac_adts_8_channels_no_pce:76a81307fdd14e0c033ea8e9b42a2b78-ok:passed:20171117-190136:0.053130324

View File

@ -0,0 +1,13 @@
#!/usr/bin/ruby -w
file = "data/aac/7_1_channels_no_pce.aac"
# T_622aac_adts_8_channels_no_pce
describe "mkvmerge / ADTS AAC files with 7.1 channels without a program config element"
test_merge file
test "identification" do
fail unless identify_json(file)["tracks"][0]["properties"]["audio_channels"] == 8
"ok"
end