diff --git a/ChangeLog b/ChangeLog index f4d9a32b4..96667fc10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-07-04 Moritz Bunkus + * 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. diff --git a/src/input/r_mpeg_ts.cpp b/src/input/r_mpeg_ts.cpp index b2e53dc4e..fa63aff14 100644 --- a/src/input/r_mpeg_ts.cpp +++ b/src/input/r_mpeg_ts.cpp @@ -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; diff --git a/tests/results.txt b/tests/results.txt index d3eee60ef..a0189a38f 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -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 diff --git a/tests/test-501mpeg_ts_pat_and_pmt_crc_errors.rb b/tests/test-501mpeg_ts_pat_and_pmt_crc_errors.rb new file mode 100755 index 000000000..f961a2982 --- /dev/null +++ b/tests/test-501mpeg_ts_pat_and_pmt_crc_errors.rb @@ -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"