[vlc-commits] demux: ts: don't pass corrupted packets to sections handler

Francois Cartegnie git at videolan.org
Thu Dec 22 19:45:56 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 22 15:58:18 2016 +0100| [dd12f84ea33f10b38d39bb8b686fdc50c1a2c2e4] | committer: Francois Cartegnie

demux: ts: don't pass corrupted packets to sections handler

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

 modules/demux/mpeg/ts.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 2464cbe..8414819 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -176,6 +176,7 @@ static mtime_t GetPCR( const block_t * );
 
 static block_t * ProcessTSPacket( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt, int * );
 static bool GatherPESData( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk, size_t );
+static bool GatherSectionsData( demux_t *p_demux, ts_pid_t *, block_t *, size_t );
 static void ProgramSetPCR( demux_t *p_demux, ts_pmt_t *p_prg, mtime_t i_pcr );
 
 static block_t* ReadTSPacket( demux_t *p_demux );
@@ -706,11 +707,9 @@ static int Demux( demux_t *p_demux )
             {
                 b_frame = GatherPESData( p_demux, p_pid, p_pkt, i_header );
             }
-            else if( p_pid->u.p_pes->transport == TS_TRANSPORT_SECTIONS &&
-                    !(p_pkt->i_flags & BLOCK_FLAG_SCRAMBLED) )
+            else if( p_pid->u.p_pes->transport == TS_TRANSPORT_SECTIONS )
             {
-                ts_sections_processor_Push( p_pid->u.p_pes->p_sections_proc, p_pkt->p_buffer );
-                b_frame = true;
+                b_frame = GatherSectionsData( p_demux, p_pid, p_pkt, i_header );
             }
             else // pid->u.p_pes->transport == TS_TRANSPORT_IGNORE
             {
@@ -2670,6 +2669,27 @@ static bool GatherPESData( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt, size
     return b_ret;
 }
 
+static bool GatherSectionsData( demux_t *p_demux, ts_pid_t *p_pid, block_t *p_pkt, size_t i_skip )
+{
+    VLC_UNUSED(i_skip); VLC_UNUSED(p_demux);
+    bool b_ret = false;
+
+    if( p_pkt->i_flags & BLOCK_FLAG_DISCONTINUITY )
+    {
+        ts_sections_processor_Reset( p_pid->u.p_pes->p_sections_proc );
+    }
+
+    if( (p_pkt->i_flags & (BLOCK_FLAG_SCRAMBLED | BLOCK_FLAG_CORRUPTED)) == 0 )
+    {
+        ts_sections_processor_Push( p_pid->u.p_pes->p_sections_proc, p_pkt->p_buffer );
+        b_ret = true;
+    }
+
+    block_Release( p_pkt );
+
+    return b_ret;
+}
+
 void TsChangeStandard( demux_sys_t *p_sys, ts_standards_e v )
 {
     if( p_sys->standard != TS_STANDARD_AUTO &&



More information about the vlc-commits mailing list