[vlc-commits] demux: ts: discard duplicated payloads

Francois Cartegnie git at videolan.org
Wed Dec 14 16:02:13 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 14 15:26:36 2016 +0100| [c5ef1b9eb7403bc69e88f30cbf9a5a21221f916c] | committer: Francois Cartegnie

demux: ts: discard duplicated payloads

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

 modules/demux/mpeg/ts.c     | 8 ++++++++
 modules/demux/mpeg/ts_pid.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index c0f7d4d..70fec10 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -2398,6 +2398,7 @@ static bool ProcessTSPacket( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt )
     if( b_payload && i_diff == 1 )
     {
         pid->i_cc = ( pid->i_cc + 1 ) & 0xf;
+        pid->i_dup = 0;
     }
     else
     {
@@ -2407,12 +2408,19 @@ static bool ProcessTSPacket( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt )
                       pid->i_pid, i_cc );
             pid->i_cc = i_cc;
         }
+        else if( i_diff == 0 && pid->i_dup == 0 && b_payload )
+        {
+            /* Discard duplicated payload 2.4.3.3 */
+            i_skip = 188;
+            pid->i_dup++;
+        }
         else if( i_diff != 0 && !b_discontinuity )
         {
             msg_Warn( p_demux, "discontinuity received 0x%x instead of 0x%x (pid=%d)",
                       i_cc, ( pid->i_cc + 1 )&0x0f, pid->i_pid );
 
             pid->i_cc = i_cc;
+            pid->i_dup = 0;
             if( p_pes->gather.p_data &&
                 p_pes->p_es->fmt.i_cat != VIDEO_ES &&
                 p_pes->p_es->fmt.i_cat != AUDIO_ES )
diff --git a/modules/demux/mpeg/ts_pid.h b/modules/demux/mpeg/ts_pid.h
index 484d2cc..58159ce 100644
--- a/modules/demux/mpeg/ts_pid.h
+++ b/modules/demux/mpeg/ts_pid.h
@@ -54,6 +54,7 @@ struct ts_pid_t
 
     uint8_t     i_flags;
     uint8_t     i_cc;   /* countinuity counter */
+    uint8_t     i_dup;  /* duplicate counter */
     uint8_t     type;
 
     uint16_t    i_refcount;



More information about the vlc-commits mailing list