[vlc-commits] demux: ts: fix inconsistency on un/seekable UNKOWN_ES

Francois Cartegnie git at videolan.org
Mon Oct 10 16:07:15 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Oct  9 17:26:35 2016 +0200| [c78a7a1c856fa222d8c470839eb69d3ac78f295c] | committer: Francois Cartegnie

demux: ts: fix inconsistency on un/seekable UNKOWN_ES

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

 modules/demux/mpeg/ts.c     | 8 +++++---
 modules/demux/mpeg/ts_psi.c | 5 +----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 49aeee7..7c36598 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -2514,13 +2514,15 @@ void AddAndCreateES( demux_t *p_demux, ts_pid_t *pid, bool b_create_delayed )
 
     if( pid && p_sys->es_creation == CREATE_ES )
     {
-        DoCreateES( p_demux, pid->u.p_pes->p_es, NULL );
+        ts_pes_es_t *p_es = pid->u.p_pes->p_es;
+        DoCreateES( p_demux, p_es, NULL );
 
         /* Update the default program == first created ES group */
-        if( p_sys->b_default_selection && p_sys->programs.i_size > 0)
+        if( p_sys->b_default_selection && p_sys->programs.i_size > 0 &&
+            (p_es->fmt.i_cat == VIDEO_ES || p_es->fmt.i_cat == AUDIO_ES) )
         {
             p_sys->b_default_selection = false;
-            const int i_first_program = pid->u.p_pes->p_es->p_program->i_number;
+            const int i_first_program = p_es->p_program->i_number;
             if( p_sys->programs.p_elems[0] != i_first_program )
                 p_sys->programs.p_elems[0] = i_first_program;
             msg_Dbg( p_demux, "Default program is %d", i_first_program );
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 0a6254e..6fae02c 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -1582,8 +1582,6 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
                      (p_dr->p_data[0] << 8) | p_dr->p_data[1] );
         }
 
-        const bool b_create_es = (p_pes->p_es->fmt.i_cat != UNKNOWN_ES);
-
         /* Now check and merge */
         if( b_pid_inuse ) /* We need to compare to the existing pes/es */
         {
@@ -1644,8 +1642,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
             }
         }
         /* Nothing to do, pes is now just set */
-        if( b_create_es )
-            AddAndCreateES( p_demux, pespid, false );
+        AddAndCreateES( p_demux, pespid, false );
     }
 
     /* Set CAM descrambling */



More information about the vlc-commits mailing list