From: Jasmin Jessich Date: Sun, 25 Feb 2018 02:51:02 +0000 (+0100) Subject: Remove duplicate packets in linuxdvb_ddci_put X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=578acc2650147817a95b60862568caedb8fcdc60;p=thirdparty%2Ftvheadend.git Remove duplicate packets in linuxdvb_ddci_put Ignore duplicate PIDs before sending them to the CAM (this are PIDs <20 only). Signed-off-by: Jasmin Jessich --- diff --git a/src/descrambler/dvbcam.c b/src/descrambler/dvbcam.c index 53d02634e..a30940f12 100644 --- a/src/descrambler/dvbcam.c +++ b/src/descrambler/dvbcam.c @@ -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; } diff --git a/src/input/mpegts/linuxdvb/linuxdvb_ddci.c b/src/input/mpegts/linuxdvb/linuxdvb_ddci.c index 712f49935..a2aa4fc6c 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_ddci.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_ddci.c @@ -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 ); } diff --git a/src/input/mpegts/linuxdvb/linuxdvb_private.h b/src/input/mpegts/linuxdvb/linuxdvb_private.h index 10d700e35..6341bf848 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_private.h +++ b/src/input/mpegts/linuxdvb/linuxdvb_private.h @@ -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