mpegts: attempt to avoid unecessary reporting of CRC failure on CC error

I've also hidden the PSI CC error output, put in debug, so it doesn't flood
logs and generally annoy people.
This commit is contained in:
Adam Sutton 2014-04-21 22:31:30 +01:00
parent a3b2ad5e5b
commit 066728b9a0
4 changed files with 17 additions and 7 deletions

View file

@ -202,7 +202,7 @@ struct mpegts_table_feed {
* Assemble SI section
*/
void mpegts_psi_section_reassemble
( mpegts_psi_section_t *ps, const uint8_t *tsb, int crc,
( mpegts_psi_section_t *ps, const uint8_t *tsb, int crc, int ccerr,
mpegts_psi_section_callback_t cb, void *opaque );
/* **************************************************************************

View file

@ -676,10 +676,15 @@ mpegts_input_table_dispatch ( mpegts_mux_t *mm, mpegts_table_feed_t *mtf )
mt = vec[i];
if (!mt->mt_destroyed && mt->mt_pid == pid) {
if (mtf->mtf_tsb[3] & 0x10) {
if (mt->mt_cc != -1 && mt->mt_cc != cc)
tvhwarn("psi", "PID %04X CC error %d != %d", pid, mt->mt_cc, cc);
int ccerr = 0;
if (mt->mt_cc != -1 && mt->mt_cc != cc) {
ccerr = 1;
/* Ignore dupes (shouldn't have payload set, but some seem to) */
//if (((mt->mt_cc + 15) & 0xf) != cc)
tvhdebug("psi", "PID %04X CC error %d != %d", pid, cc, mt->mt_cc);
}
mt->mt_cc = (cc + 1) & 0xF;
mpegts_psi_section_reassemble(&mt->mt_sect, mtf->mtf_tsb, 0,
mpegts_psi_section_reassemble(&mt->mt_sect, mtf->mtf_tsb, 0, ccerr,
mpegts_table_dispatch, mt);
}
}

View file

@ -219,13 +219,16 @@ mpegts_psi_section_reassemble0
*/
void
mpegts_psi_section_reassemble
(mpegts_psi_section_t *ps, const uint8_t *tsb, int crc,
(mpegts_psi_section_t *ps, const uint8_t *tsb, int crc, int ccerr,
mpegts_psi_section_callback_t cb, void *opaque)
{
int off = tsb[3] & 0x20 ? tsb[4] + 5 : 4;
int pusi = tsb[1] & 0x40;
int r;
if (ccerr)
ps->ps_lock = 0;
if(off >= 188) {
ps->ps_lock = 0;
return;

View file

@ -66,7 +66,7 @@ static void
ts_recv_packet0
(mpegts_service_t *t, elementary_stream_t *st, const uint8_t *tsb)
{
int off, pusi, cc, error;
int off, pusi, cc, error, ccerr;
service_set_streaming_status_flags((service_t*)t, TSS_MUX_PACKETS);
@ -84,6 +84,7 @@ ts_recv_packet0
if(tsb[3] & 0x10) {
cc = tsb[3] & 0xf;
if(st->es_cc != -1 && cc != st->es_cc) {
ccerr = 1;
/* Incorrect CC */
limitedlog(&st->es_loglimit_cc, "TS", service_component_nicename(st),
"Continuity counter error");
@ -104,7 +105,8 @@ ts_recv_packet0
case SCT_CA:
if(st->es_section == NULL)
st->es_section = calloc(1, sizeof(mpegts_psi_section_t));
mpegts_psi_section_reassemble(st->es_section, tsb, 0, got_ca_section, st);
mpegts_psi_section_reassemble(st->es_section, tsb, 0, ccerr,
got_ca_section, st);
break;
default: