TruehD parser: be more strict during resync

AC-3 frame recognition is much too unreliable as the AC-3 sync word is
only 12 bits long. Therefore the resync mechanism should only look for
the 32 bits long TrueHD/MLP sync words.
This commit is contained in:
Moritz Bunkus 2016-01-04 20:58:10 +01:00
parent cbe29e8a06
commit eb8acb6942
4 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2016-01-04 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: fixed TrueHD detection both as raw streams as
well as inside other contains if the stream does not start with a
TrueHD sync frame.
2016-01-03 Moritz Bunkus <moritz@bunkus.org> 2016-01-03 Moritz Bunkus <moritz@bunkus.org>
* MKVToolNix GUI: new merge tool feature: added a layout for the * MKVToolNix GUI: new merge tool feature: added a layout for the

View File

@ -58,7 +58,7 @@ truehd_frame_t::parse_ac3_header(unsigned char const *data,
m_type = truehd_frame_t::sync; m_type = truehd_frame_t::sync;
m_size = m_ac3_header.m_bytes; m_size = m_ac3_header.m_bytes;
return size >= m_ac3_header.m_bytes; return size >= m_ac3_header.m_bytes ? verify_ac3_checksum(data, size) : false;
} }
bool bool
@ -235,7 +235,7 @@ truehd_parser_c::resync(unsigned int offset) {
for (offset = offset + 4; (offset + 4) < size; ++offset) { for (offset = offset + 4; (offset + 4) < size; ++offset) {
uint32_t sync_word = get_uint32_be(&data[offset]); uint32_t sync_word = get_uint32_be(&data[offset]);
if ((TRUEHD_SYNC_WORD == sync_word) || (MLP_SYNC_WORD == sync_word) || (AC3_SYNC_WORD == get_uint16_be(&data[offset - 4]))) { if (mtx::included_in(sync_word, TRUEHD_SYNC_WORD, MLP_SYNC_WORD)) {
m_sync_state = state_synced; m_sync_state = state_synced;
return offset - 4; return offset - 4;
} }

View File

@ -370,3 +370,4 @@ T_521mp4_edit_list_constant_offset_with_segment_duration_not_0:07984c40325903cbc
T_522mpeg_1_2_es_no_start_code_at_beginning:067554d94399178b6bb56b49746b04b6:passed:20151230-182435:0.299243222 T_522mpeg_1_2_es_no_start_code_at_beginning:067554d94399178b6bb56b49746b04b6:passed:20151230-182435:0.299243222
T_523mpeg_ts_pes_size_0:5351b2c74ad4327eeecee1ccf658ef5f-217f7e6e3e04a6afe253487af08c0598:passed:20151230-221825:1.635929691 T_523mpeg_ts_pes_size_0:5351b2c74ad4327eeecee1ccf658ef5f-217f7e6e3e04a6afe253487af08c0598:passed:20151230-221825:1.635929691
T_524mpeg2_misdetected_as_truehd:b023d230d68c2545c6cb6859786c692b:passed:20160102-222743:1.10526128 T_524mpeg2_misdetected_as_truehd:b023d230d68c2545c6cb6859786c692b:passed:20160102-222743:1.10526128
T_525truehd_doesnt_start_with_sync_frame:a7f55b158ec9a3438eaee8b28b13a7cf:passed:20160104-205804:0.313378755

View File

@ -0,0 +1,5 @@
#!/usr/bin/ruby -w
# T_525truehd_doesnt_start_with_sync_frame
describe "mkvmerge / TrueHD recognition if the stream doesn't start with a TrueHD sync frame"
test_identify "data/truehd/truehd-not-starting-with-sync-frame.thd"