]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts: attempt to avoid unecessary reporting of CRC failure on CC error
authorAdam Sutton <dev@adamsutton.me.uk>
Mon, 21 Apr 2014 21:31:30 +0000 (22:31 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 21 Apr 2014 21:31:30 +0000 (22:31 +0100)
I've also hidden the PSI CC error output, put in debug, so it doesn't flood
logs and generally annoy people.

src/input/mpegts.h
src/input/mpegts/mpegts_input.c
src/input/mpegts/mpegts_table.c
src/input/mpegts/tsdemux.c

index 3ac69db94990208f5ab1f4f2c71d53d4553f9897..321c22ae8e9b0fa9b31aa2486a0dc3a7a6d187ad 100644 (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 );
 
 /* **************************************************************************
index e60ff43d1a8320ac9ea53a0ec9a67c5c0fe1193b..225407999f15b480a1707da66ccc8f2ca192d82a 100644 (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);
       }
     }
index 2d8d0e9600d0f2d05ec1a24dd232e1649ac8c24b..b3eb80940c0fab3d5146a0a3bf11b8deae7177a6 100644 (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;
index 685d4c9696929cfc19c53924a32945e920b8946a..42434d3a1ed4e775cfe08ff21b9748bfff3ebd43 100644 (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: