[vlc-commits] demux: ts: use tristate for PAT fix

Francois Cartegnie git at videolan.org
Wed Oct 7 15:46:24 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct  7 15:26:14 2015 +0200| [de2717f85714ae2864c64dfda565089f03c27af6] | committer: Francois Cartegnie

demux: ts: use tristate for PAT fix

As callback does not provide return status, we
need to prevent fix retries.

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

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

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 770c19b..065d496 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -427,7 +427,7 @@ struct demux_sys_t
     {
         mtime_t i_first_dts;     /* first dts encountered for the stream */
         int     i_timesourcepid; /* which pid we saved the dts from */
-        bool    b_pat_deadline;  /* set if we haven't seen PAT within MIN_PAT_INTERVAL */
+        enum { PAT_WAITING = 0, PAT_MISSING, PAT_FIXTRIED } status; /* set if we haven't seen PAT within MIN_PAT_INTERVAL */
     } patfix;
 
     vdr_info_t  vdr;
@@ -826,10 +826,10 @@ static void ProbePES( demux_t *p_demux, ts_pid_t *pid, const uint8_t *p_pesstart
         p_sys->patfix.i_timesourcepid = pid->i_pid;
     }
     else if( p_sys->patfix.i_timesourcepid == pid->i_pid && i_dts > -1 &&
-             !p_sys->patfix.b_pat_deadline )
+             p_sys->patfix.status == PAT_WAITING )
     {
         if( i_dts - p_sys->patfix.i_first_dts > TO_SCALE(MIN_PAT_INTERVAL) )
-            p_sys->patfix.b_pat_deadline = true;
+            p_sys->patfix.status = PAT_MISSING;
     }
 
 }
@@ -1010,6 +1010,10 @@ static int Open( vlc_object_t *p_this )
     p_sys->csa = NULL;
     p_sys->b_start_record = false;
 
+    p_sys->patfix.i_first_dts = -1;
+    p_sys->patfix.i_timesourcepid = 0;
+    p_sys->patfix.status = PAT_WAITING;
+
 # define VLC_DVBPSI_DEMUX_TABLE_INIT(table,obj) \
     do { \
         if( !dvbpsi_AttachDemux( (table)->u.p_psi->handle, (dvbpsi_demux_new_cb_t)PSINewTableCallBack, (obj) ) ) \
@@ -1237,8 +1241,11 @@ static int Demux( demux_t *p_demux )
     bool b_wait_es = p_sys->i_pmt_es <= 0;
 
     /* If we had no PAT within MIN_PAT_INTERVAL, create PAT/PMT from probed streams */
-    if( p_sys->i_pmt_es == 0 && !SEEN(GetPID(p_sys, 0)) && p_sys->patfix.b_pat_deadline )
+    if( p_sys->i_pmt_es == 0 && !SEEN(GetPID(p_sys, 0)) && p_sys->patfix.status == PAT_MISSING )
+    {
         MissingPATPMTFixup( p_demux );
+        p_sys->patfix.status = PAT_FIXTRIED;
+    }
 
     /* We read at most 100 TS packet or until a frame is completed */
     for( unsigned i_pkt = 0; i_pkt < p_sys->i_ts_read; i_pkt++ )



More information about the vlc-commits mailing list