mpegts: some minor corrections to MPEG-TS packet processing

Relates to #1986
This commit is contained in:
Adam Sutton 2014-04-14 17:48:31 +01:00
parent f8e48bdc39
commit 2e942e6a54
6 changed files with 12 additions and 12 deletions

View file

@ -173,7 +173,7 @@ struct mpegts_table
int mt_destroyed; // Refcounting
int mt_refcount;
int mt_cc;
int8_t mt_cc;
mpegts_psi_section_t mt_sect;

View file

@ -642,11 +642,13 @@ mpegts_input_table_dispatch ( mpegts_mux_t *mm, mpegts_table_feed_t *mtf )
for (i = 0; i < len; i++) {
mt = vec[i];
if (!mt->mt_destroyed && mt->mt_pid == pid) {
if (mt->mt_cc != -1 && mt->mt_cc != cc)
tvhdebug("psi", "pid %04X cc error %d != %d", pid, mt->mt_cc, cc);
mt->mt_cc = (cc + 1) % 16;
mpegts_psi_section_reassemble(&mt->mt_sect, mtf->mtf_tsb, 0,
mpegts_table_dispatch, mt);
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);
mt->mt_cc = (cc + 1) & 0xF;
mpegts_psi_section_reassemble(&mt->mt_sect, mtf->mtf_tsb, 0,
mpegts_table_dispatch, mt);
}
}
mpegts_table_release(mt);
}

View file

@ -53,7 +53,7 @@ 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)) {
tvhdebug(mt->mt_name, "invalid checksum");
tvhwarn(mt->mt_name, "invalid checksum");
return;
}

View file

@ -83,7 +83,7 @@ ts_recv_packet0
if(tsb[3] & 0x10) {
cc = tsb[3] & 0xf;
if(st->es_cc_valid && cc != st->es_cc) {
if(st->es_cc != -1 && cc != st->es_cc) {
/* Incorrect CC */
limitedlog(&st->es_loglimit_cc, "TS", service_component_nicename(st),
"Continuity counter error");
@ -94,7 +94,6 @@ ts_recv_packet0
if(!pusi)
error |= 0x2;
}
st->es_cc_valid = 1;
st->es_cc = (cc + 1) & 0xf;
}

View file

@ -181,7 +181,7 @@ const idclass_t service_class = {
static void
stream_init(elementary_stream_t *st)
{
st->es_cc_valid = 0;
st->es_cc = -1;
st->es_startcond = 0xffffffff;
st->es_curdts = PTS_UNSET;

View file

@ -55,8 +55,7 @@ typedef struct elementary_stream {
a teletext stream. this is the pid
of the teletext stream */
uint8_t es_cc; /* Last CC */
uint8_t es_cc_valid; /* Is CC valid at all? */
int8_t es_cc; /* Last CC */
avgstat_t es_cc_errors;
avgstat_t es_rate;