]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts: mpegts_table_dispatch() handle MT_CRC correctly, fixes #2897
authorJaroslav Kysela <perex@perex.cz>
Wed, 27 May 2015 08:30:45 +0000 (10:30 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 27 May 2015 09:31:05 +0000 (11:31 +0200)
src/input/mpegts/mpegts_table.c

index 67526d2a7a386c875f7633b61cc2f0b2f459a1ef..0ee8a4fbf606543e64f7c3b941db366d0c10462f 100644 (file)
@@ -79,26 +79,28 @@ void
 mpegts_table_dispatch
   ( const uint8_t *sec, size_t r, void *aux )
 {
-  int tid, len, ret;
+  int tid, len, crc_len, ret;
   mpegts_table_t *mt = aux;
 
   if(mt->mt_destroyed)
     return;
 
   tid = sec[0];
-  len = ((sec[1] & 0x0f) << 8) | sec[2];
 
   /* Check table mask */
   if((tid & mt->mt_mask) != mt->mt_table)
     return;
 
+  len = ((sec[1] & 0x0f) << 8) | sec[2];
+  crc_len = (mt->mt_flags & MT_CRC) ? 4 : 0;
+
   /* Pass with tableid / len in data */
   if (mt->mt_flags & MT_FULL)
-    ret = mt->mt_callback(mt, sec, len+3, tid);
+    ret = mt->mt_callback(mt, sec, len+3-crc_len, tid);
 
   /* Pass w/out tableid/len in data */
   else
-    ret = mt->mt_callback(mt, sec+3, len, tid);
+    ret = mt->mt_callback(mt, sec+3, len-crc_len, tid);
   
   /* Good */
   if(ret >= 0)