MPEG TS reader: require five consecutive, identical AAC headers for track type detection

Using only a single one may lead to false positives and consequently
to wrong track parameters, especially if the file was cut at an
arbitrary position.

Fixes the audio-related part of #1938.
This commit is contained in:
Moritz Bunkus 2017-04-12 22:52:53 +02:00
parent 0a4c292858
commit 5fbcd0aa67
4 changed files with 15 additions and 1 deletions

View File

@ -41,6 +41,10 @@
only the arrays actually present are parsed, and they can be in any order.
This fixes mkvinfo's output for Matroska files created from files such as
the one from #1938.
* mkvmerge: MPEG TS reader, AAC: mkvmerge will now require five consecutive
AAC headers with identical parameters before track type determination is
considered valid. This avoids false positives and consequently wrong track
parameters. Fixes the audio-related part of #1938.
## Build system changes

View File

@ -332,8 +332,12 @@ int
track_c::new_stream_a_aac() {
add_pes_payload_to_probe_data();
auto pos = aac::parser_c::find_consecutive_frames(m_probe_data->get_buffer(), m_probe_data->get_size(), 5);
if (pos == -1)
return FILE_STATUS_MOREDATA;
auto parser = aac::parser_c{};
parser.add_bytes(m_probe_data->get_buffer(), m_probe_data->get_size());
parser.add_bytes(m_probe_data->get_buffer() + pos, m_probe_data->get_size() - pos);
if (!parser.frames_available() || !parser.headers_parsed())
return FILE_STATUS_MOREDATA;

View File

@ -437,3 +437,4 @@ T_588h265_must_copy_bitstream_restriction_info_in_vui_parameters:73adcf66e93a909
T_589h264_forcing_default_duration_in_fields_with_source_matroska:57ec2c6f2b5f526a0bc0ae4b7d58a7fc-40000000+40000000+true-21388568453e93db9c2d8f57af26eb0b-20000000+20000000+true-6122f1005d1f64f9958f275220251ed9-30000000+30000000+true-6ee9a2e29ac6cd451bb971daf7b3a41e-60000000+60000000+true-205658c0f0458073f94f06a6b300ebb0-20000000+20000000+true:passed:20170331-165013:0.244234938
T_590invalid_track_language_elements:39273b8f3b06c67c444c698d4c206847-fbb7ad6e65f0d85cacefd7765605757a-5193400637dc65f4028be97aea853e4b:passed:20170404-191832:0.036965692
T_591hevc_wrong_number_of_parameter_sets:cc0ff46884d832c3b7234136f963bc39:passed:20170412-165246:0.341087191
T_592mpeg_ts_aac_wrong_track_parameters_detected:25116993128e73fe9251dc7161ae8030:passed:20170412-225238:0.044257474

View File

@ -0,0 +1,5 @@
#!/usr/bin/ruby -w
# T_592mpeg_ts_aac_wrong_track_parameters_detected
describe "mkvmerge / MPEG TS, AAC: false positive during AAC header detection leading to wrong track parameters"
test_merge "data/h265/wrong_number_of_parameter_sets_in_hevcc.ts", :args => "--no-video"