]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts: stop NIT processing from hanging
authorAdam Sutton <dev@adamsutton.me.uk>
Wed, 27 Nov 2013 17:50:24 +0000 (17:50 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Wed, 27 Nov 2013 17:50:24 +0000 (17:50 +0000)
Was stupidly returning error (instead of marking complete) when unwanted
NID is detected. This causes real problems on DVB-C, and possibly DVB-S.

Might need to revisit some SDT stuff, which I think was blocking, and
now isn't waiting, for NIT.

src/input/mpegts.h
src/input/mpegts/dvb_psi.c

index 6ac7de1dd1c57d05fcb47bc39ccbef8b37c1f30d..ef01a3e2ddc2708e9a65075119b37c9960bce985 100644 (file)
@@ -142,6 +142,7 @@ struct mpegts_table
   RB_HEAD(,mpegts_table_state) mt_state;
   int mt_complete;
   int mt_incomplete;
+  int mt_finished;
 
   int mt_count;
 
index 92085a31b038c68feb8c2734bdfd7c574d656874..88450adc5c4753cd64ba20058238db74e3a68ebd 100644 (file)
@@ -421,6 +421,7 @@ mpegts_table_state_reset
     mt->mt_complete--;
     mt->mt_incomplete++;
   }
+  mt->mt_finished = 0;
   st->complete = 0;
   memset(st->sections, 0, sizeof(st->sections));
   for (i = 0; i < last / 32; i++)
@@ -465,7 +466,9 @@ dvb_table_complete
              mt->mt_incomplete, mt->mt_complete, total);
     return -1;
   }
-  tvhdebug(mt->mt_name, "subtable completed");
+  if (!mt->mt_finished)
+    tvhdebug(mt->mt_name, "completed pid %d table %08X / %08x", mt->mt_pid, mt->mt_table, mt->mt_mask);
+  mt->mt_finished = 1;
   return 0;
 }
 
@@ -745,17 +748,18 @@ dvb_nit_callback
   r = dvb_table_begin(mt, ptr, len, tableid, nbid, 7, &st, &sect, &last, &ver);
   if (r != 1) return r;
 
-  /* BAT */
+  /* NIT */
   if (tableid != 0x4A) {
 
     /* Specific NID */
     if (mn->mn_nid) {
-      if (mn->mn_nid != nbid)
-        return -1;
+      if (mn->mn_nid != nbid) {
+        return dvb_table_end(mt, st, sect);
+      }
   
     /* Only use "this" network */
     } else if (tableid != 0x40) {
-      return -1;
+      return dvb_table_end(mt, st, sect);
     }
   }