* 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 );
/* **************************************************************************
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);
}
}
*/
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;
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);
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");
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: