MPEG TS reader: handle all PATs/PMTs containing CRC errors

Fixes #1336.
This commit is contained in:
Moritz Bunkus 2015-07-04 11:10:23 +02:00
parent e412375b01
commit eee3a45663
4 changed files with 16 additions and 10 deletions

View File

@ -1,5 +1,8 @@
2015-07-04 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: fixed handling of MPEG transport streams
where all PATs and PMTs have CRC errors. Fixes #1336.
* MKVToolNix GUI: new merge tool feature: implemented support for
re-ordering new attachments via drag & drop. Implements #1276.

View File

@ -690,16 +690,13 @@ mpeg_ts_reader_c::read_headers() {
boost::format("mpeg_ts_reader_c::read_headers: EOF during detection. #tracks %1% #PAT CRC errors %2% #PMT CRC errors %3% PAT found %4% PMT found %5%\n")
% tracks.size() % m_num_pat_crc_errors % m_num_pmt_crc_errors % PAT_found % PMT_found);
// If this is the second time around then abort.
if (!m_validate_pat_crc || ! m_validate_pmt_crc)
break;
if (!PAT_found && m_validate_pat_crc)
m_validate_pat_crc = false;
m_validate_pat_crc = PAT_found || (m_num_pat_crc_errors == 0);
m_validate_pmt_crc = PMT_found || (m_num_pmt_crc_errors == 0);
else if (PAT_found && !PMT_found && m_validate_pmt_crc)
m_validate_pmt_crc = false;
// If there haven't been any errors for neither PAT nor PMT then
// abort.
if (m_validate_pat_crc && m_validate_pmt_crc)
else
break;
m_in->setFilePointer(0);
@ -858,7 +855,7 @@ mpeg_ts_reader_c::parse_pat(unsigned char *pat) {
uint32_t read_CRC = get_uint32_be(pat + 3 + pat_section_length - 4);
if (elapsed_CRC != read_CRC) {
mxdebug_if(m_debug_pat_pmt, boost::format("mpeg_ts_reader_c::parse_pat: Wrong PAT CRC !!! Elapsed = 0x%|1$08x|, read 0x%|2$08x|\n") % elapsed_CRC % read_CRC);
mxdebug_if(m_debug_pat_pmt, boost::format("mpeg_ts_reader_c::parse_pat: Wrong PAT CRC !!! Elapsed = 0x%|1$08x|, read 0x%|2$08x|, validate PAT CRC? %3%\n") % elapsed_CRC % read_CRC % m_validate_pat_crc);
++m_num_pat_crc_errors;
if (m_validate_pat_crc)
return -1;
@ -940,7 +937,7 @@ mpeg_ts_reader_c::parse_pmt(unsigned char *pmt) {
uint32_t read_CRC = get_uint32_be(pmt + 3 + pmt_section_length - 4);
if (elapsed_CRC != read_CRC) {
mxdebug_if(m_debug_pat_pmt, boost::format("mpeg_ts_reader_c::parse_pmt: Wrong PMT CRC !!! Elapsed = 0x%|1$08x|, read 0x%|2$08x|\n") % elapsed_CRC % read_CRC);
mxdebug_if(m_debug_pat_pmt, boost::format("mpeg_ts_reader_c::parse_pmt: Wrong PMT CRC !!! Elapsed = 0x%|1$08x|, read 0x%|2$08x|, validate PMT CRC? %3%\n") % elapsed_CRC % read_CRC % m_validate_pmt_crc);
++m_num_pmt_crc_errors;
if (m_validate_pmt_crc)
return -1;

View File

@ -346,3 +346,4 @@ T_497crash_in_base64_decoder:f6526cfaaef01627c52ee2ba25f03255:passed:20150601-19
T_498mp2_misidentification:a7216d2e17a82182705397e2b901737d-489aeeff657a4d2af73378c8542cc428:passed:20150610-111131:0.763502595
T_499propedit_tags_and_track_properties:0075366ca11568fbb5c77c55298d0068:passed:20150621-111029:0.162830224
T_500mp4_eac3_fourcc_ec_3:ceb9015450fa8322f6ad308a7b852c41:passed:20150621-224248:0.192381554
T_501mpeg_ts_pat_and_pmt_crc_errors:7e6701c3535a96d726b6036fd5b0c5f5:passed:20150704-110859:0.857051787

View File

@ -0,0 +1,5 @@
#!/usr/bin/ruby -w
# T_501mpeg_ts_pat_and_pmt_crc_errors
describe "mkvmerge / MPEG TS files, all PATs and PMTs with CRC errors"
test_identify "data/ts/pat_pmt_crc_errors.m2ts"