[vlc-commits] demux: ts: PATFix replacement condition fix

Francois Cartegnie git at videolan.org
Fri Feb 5 09:42:56 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb  4 18:36:22 2021 +0100| [ba5f3c7c3ef7ec8b5f65f7ac09e9c59f9ad6c6a0] | committer: Francois Cartegnie

demux: ts: PATFix replacement condition fix

could fail depending on PAT version

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

 modules/demux/mpeg/ts.c     |  3 ++-
 modules/demux/mpeg/ts_psi.c | 24 ++++++++++++------------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index b294d06d0e..cc0edb2371 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -630,8 +630,9 @@ static int Demux( demux_t *p_demux )
     /* 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.status == PAT_MISSING )
     {
-        GetPID(p_sys, 0)->u.p_pat->b_generated = true;
+        msg_Warn( p_demux, "Generating PAT as we still have not received one" );
         MissingPATPMTFixup( p_demux );
+        GetPID(p_sys, 0)->u.p_pat->b_generated = true;
         p_sys->patfix.status = PAT_FIXTRIED;
     }
 
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 756cdaf9ac..f5614fe2c9 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -101,20 +101,21 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
         return;
     }
 
-    /* check versioning changes */
-    if( !p_pat->b_generated )
+    /* override hotfixes */
+    if( p_pat->b_generated )
     {
-        /* override hotfixes */
-        if( ( p_pat->i_version != -1 && p_dvbpsipat->i_version == p_pat->i_version ) ||
-            ( p_pat->i_ts_id != -1 && p_dvbpsipat->i_ts_id != p_pat->i_ts_id ) )
-        {
-            dvbpsi_pat_delete( p_dvbpsipat );
-            return;
-        }
+        p_pat->b_generated = false;
+        p_pat->i_version = -1;
+        p_pat->i_ts_id = -1;
+        msg_Warn( p_demux, "Replacing generated PAT with one received from stream" );
     }
-    else if( p_pat->i_version != -1 )
+
+    /* check versioning changes */
+    if( ( p_pat->i_version != -1 && p_dvbpsipat->i_version == p_pat->i_version ) ||
+        ( p_pat->i_ts_id != -1 && p_dvbpsipat->i_ts_id != p_pat->i_ts_id ) )
     {
-        msg_Warn( p_demux, "Replacing generated PAT with one received from stream" );
+        dvbpsi_pat_delete( p_dvbpsipat );
+        return;
     }
 
     /* check content */
@@ -208,7 +209,6 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
     }
     p_pat->i_version = p_dvbpsipat->i_version;
     p_pat->i_ts_id = p_dvbpsipat->i_ts_id;
-    p_pat->b_generated = false;
 
     for(int i=0; i<old_pmt_rm.i_size; i++)
     {



More information about the vlc-commits mailing list