[vlc-commits] demux: ts: add cc-check option for reliable transports

Francois Cartegnie git at videolan.org
Fri Jan 26 14:06:19 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan 25 21:33:49 2018 +0100| [8d43be9b5c9d357edeb0428dd53846b86a863abe] | committer: Francois Cartegnie

demux: ts: add cc-check option for reliable transports

(cherry picked from commit fffeea6124f6a3fb9c086e9668c4757ebc740207)

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

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

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 9248e8ecb4..58311c02af 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -111,6 +111,10 @@ static void Close ( vlc_object_t * );
     "Seek and position based on a percent byte position, not a PCR generated " \
     "time position. If seeking doesn't work property, turn on this option." )
 
+#define CC_CHECK_TEXT       "Check packets continuity counter"
+#define CC_CHECK_LONGTEXT   "Detect discontinuities and drop packet duplicates. " \
+                            "(bluRay sources are known broken and have false positives). "
+
 #define PCR_TEXT N_("Trust in-stream PCR")
 #define PCR_LONGTEXT N_("Use the stream PCR as a reference.")
 
@@ -148,6 +152,7 @@ vlc_module_begin ()
 
     add_bool( "ts-split-es", true, SPLIT_ES_TEXT, SPLIT_ES_LONGTEXT, false )
     add_bool( "ts-seek-percent", false, SEEK_PERCENT_TEXT, SEEK_PERCENT_LONGTEXT, true )
+    add_bool( "ts-cc-check", true, CC_CHECK_TEXT, CC_CHECK_LONGTEXT, true )
 
     add_obsolete_bool( "ts-silent" );
 
@@ -483,6 +488,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->b_canseek = false;
     p_sys->b_canfastseek = false;
     p_sys->b_ignore_time_for_positions = var_InheritBool( p_demux, "ts-seek-percent" );
+    p_sys->b_cc_check = var_InheritBool( p_demux, "ts-cc-check" );
 
     p_sys->standard = TS_STANDARD_AUTO;
     char *psz_standard = var_InheritString( p_demux, "ts-standard" );
@@ -2466,7 +2472,7 @@ static block_t * ProcessTSPacket( demux_t *p_demux, ts_pid_t *pid, block_t *p_pk
         * diff == 0 and duplicate packet (playload != 0) <- should we
         *   test the content ?
      */
-    if( b_payload )
+    if( b_payload && p_demux->p_sys->b_cc_check )
     {
         const int i_diff = ( i_cc - pid->i_cc )&0x0f;
         if( i_diff == 1 )
diff --git a/modules/demux/mpeg/ts.h b/modules/demux/mpeg/ts.h
index cb50e36ba0..c45b870302 100644
--- a/modules/demux/mpeg/ts.h
+++ b/modules/demux/mpeg/ts.h
@@ -60,6 +60,7 @@ struct demux_sys_t
     /* how many TS packet we read at once */
     unsigned    i_ts_read;
 
+    bool        b_cc_check;
     bool        b_ignore_time_for_positions;
 
     ts_standards_e standard;



More information about the vlc-commits mailing list