]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Remove duplicate packets in linuxdvb_ddci_put
authorJasmin Jessich <jasmin@anw.at>
Sun, 25 Feb 2018 02:51:02 +0000 (03:51 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 25 Feb 2018 17:58:17 +0000 (18:58 +0100)
Ignore duplicate PIDs before sending them to the CAM (this are PIDs <20
only).

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
src/descrambler/dvbcam.c
src/input/mpegts/linuxdvb/linuxdvb_ddci.c
src/input/mpegts/linuxdvb/linuxdvb_private.h

index 53d02634ec858eba5bcf72e662af15e705619fd8..a30940f12828d3c8991873bcce0c6ed8a27b11b7 100644 (file)
@@ -409,7 +409,7 @@ dvbcam_descramble_ddci(service_t *t, elementary_stream_t *st, const uint8_t *tsb
   dvbcam_active_service_t   *as = (dvbcam_active_service_t *)dr->dr_descrambler;
 
   if (as->ac != NULL)
-    linuxdvb_ddci_put(as->ac->ca->lca_transport->lddci, tsb, len);
+    linuxdvb_ddci_put(as->ac->ca->lca_transport->lddci, t, tsb, len);
 
   return 1;
 }
index 712f499352bacef330aa3e22a5fdfba2057fc18a..a2aa4fc6ce21f1123b5f7070f92b78c7020b86aa 100644 (file)
@@ -110,6 +110,7 @@ struct linuxdvb_ddci
   mpegts_mux_t               *lddci_mm;
   /* the same input used for all services */
   mpegts_input_t             *lddci_mi;
+  const uint8_t              *lddci_prev_tsb;
 };
 
 
@@ -474,7 +475,7 @@ linuxdvb_ddci_wr_thread_buffer_put
   /* We need to lock this function against linuxdvb_ddci_wr_thread_stop, because
    * linuxdvb_ddci_wr_thread_buffer_put may be executed by another thread
    * simultaneously, although the stop function is already running. Due to the
-   * race condition with the tread_running flag, it may happen, that the buffer
+   * race condition with the thread_running flag, it may happen, that the buffer
    * is not empty after the stop function is finished. The next execution of
    * linuxdvb_ddci_wr_thread_start will then re-init the queue and the wrongly
    * stored data is lost -> memory leak.
@@ -828,8 +829,26 @@ linuxdvb_ddci_open ( linuxdvb_ddci_t *lddci )
 }
 
 void
-linuxdvb_ddci_put ( linuxdvb_ddci_t *lddci, const uint8_t *tsb, int len )
-{
+linuxdvb_ddci_put
+  ( linuxdvb_ddci_t *lddci, service_t *t, const uint8_t *tsb, int len )
+{
+  /* ignore duplicates
+   * Note: Checking only the pointer is possible, because the calling
+   *       functions will execute the descrambler for the special PIDs in a
+   *       loop for each service.
+   *       If this ever changes, this code needs to be adapted!
+   */
+  /* FIXME: In case of MTD we will send all PIDs to the PID translator.
+   * This allows to know which packed is for which service, even if the PAT,
+   * CAT or EIT is the same, when they originally came from the same
+   * transponder. */
+  if (lddci->lddci_prev_tsb == tsb) return;
+  lddci->lddci_prev_tsb = tsb;
+
+  /* FIXME: For MTD add here the PID translator
+   * And also remove the CAT from the stream and generate a faked one.
+   */
+
   linuxdvb_ddci_wr_thread_buffer_put(&lddci->lddci_wr_thread, tsb, len );
 }
 
index 10d700e35c6b3cfbbf368f284a9b19e3669def02..6341bf84858b6d44fc34045fec31166d0d1ac47a 100644 (file)
@@ -460,7 +460,8 @@ linuxdvb_ddci_open ( linuxdvb_ddci_t *lddci );
 void
 linuxdvb_ddci_close ( linuxdvb_ddci_t *lddci );
 void
-linuxdvb_ddci_put ( linuxdvb_ddci_t *lddci, const uint8_t *tsb, int len );
+linuxdvb_ddci_put ( linuxdvb_ddci_t *lddci, service_t *t,
+                    const uint8_t *tsb, int len );
 void
 linuxdvb_ddci_assign ( linuxdvb_ddci_t *lddci, service_t *t );
 void