mpegts: tables - print only one table error per 10 seconds + total errors value

This commit is contained in:
Jaroslav Kysela 2014-08-20 09:10:49 +02:00
parent 2e5b239cb5
commit a82cdec82d
2 changed files with 18 additions and 3 deletions

View file

@ -197,6 +197,9 @@ struct mpegts_table
int8_t mt_cc;
time_t mt_last_perr; // last printer error
size_t mt_errors; // total number of table errors
mpegts_psi_section_t mt_sect;
struct mpegts_table_mux_cb *mt_mux_cb;

View file

@ -61,8 +61,15 @@ mpegts_table_dispatch
len = ((sec[1] & 0x0f) << 8) | sec[2];
if (tid == 0x72) { /* stuffing section */
if (len != r - 3)
tvhwarn(mt->mt_name, "stuffing found with trailing data (len %i, total %zi)", len, r);
if (len != r - 3) {
mt->mt_errors++;
if (mt->mt_last_perr + 10 < dispatch_clock) {
tvhwarn(mt->mt_name, "stuffing found with trailing data "
"(len %i, total %zi, errors %zi)",
len, r, mt->mt_errors);
mt->mt_last_perr = dispatch_clock;
}
}
dvb_table_reset(mt);
return;
}
@ -70,7 +77,12 @@ mpegts_table_dispatch
/* It seems some hardware (or is it the dvb API?) does not
honour the DMX_CHECK_CRC flag, so we check it again */
if(chkcrc && tvh_crc32(sec, r, 0xffffffff)) {
tvhwarn(mt->mt_name, "invalid checksum (len %zi)", r);
mt->mt_errors++;
if (mt->mt_last_perr + 10 < dispatch_clock) {
tvhwarn(mt->mt_name, "invalid checksum (len %zi, errors %zi)",
r, mt->mt_errors);
mt->mt_last_perr = dispatch_clock;
}
return;
}