[vlc-commits] demux: ts: avoid adding duplicated section handlers on pmt update

Francois Cartegnie git at videolan.org
Sun Jan 24 01:24:20 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jan 24 00:23:01 2016 +0100| [470e9c6bfdee779aa3b34c9a7a5051ecd855590d] | committer: Francois Cartegnie

demux: ts: avoid adding duplicated section handlers on pmt update

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=470e9c6bfdee779aa3b34c9a7a5051ecd855590d
---

 modules/demux/mpeg/sections.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mpeg/sections.c b/modules/demux/mpeg/sections.c
index adce5be..3a5573c 100644
--- a/modules/demux/mpeg/sections.c
+++ b/modules/demux/mpeg/sections.c
@@ -143,7 +143,17 @@ void ts_sections_processor_Add( ts_sections_processor_t **pp_chain,
                                 uint8_t i_table_id, uint8_t i_stream_type, bool b_raw,
                                 ts_section_callback_t pf_callback )
 {
-    ts_sections_processor_t *p_proc = malloc( sizeof(ts_sections_processor_t) );
+    ts_sections_processor_t *p_proc = *pp_chain;
+    for( ; p_proc; p_proc = p_proc->p_next )
+    {
+        /* Avoid duplicates */
+        if ( p_proc->i_stream_type == i_stream_type &&
+             p_proc->i_table_id == i_table_id &&
+             p_proc->pf_callback == pf_callback )
+            return;
+    }
+
+    p_proc = malloc( sizeof(ts_sections_processor_t) );
     if( p_proc )
     {
         ts_sections_assembler_Init( &p_proc->assembler );



More information about the vlc-commits mailing list