[vlc-commits] demux: ps: delay creation from system header

Francois Cartegnie git at videolan.org
Wed Apr 19 16:13:19 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr 19 16:09:42 2017 +0200| [1fe24f39c327b40906a3cbf75afd53349a5ecddc] | committer: Francois Cartegnie

demux: ps: delay creation from system header

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

 modules/demux/mpeg/ps.c | 12 ++++++++++--
 modules/demux/mpeg/ps.h |  7 ++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index d0ae03a37e..22f301c2a6 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -469,9 +469,11 @@ static int Demux( demux_t *p_demux )
             {
                 ps_track_t *tk = &p_sys->tk[i];
 
-                if( tk->b_seen && !tk->es && tk->fmt.i_cat != UNKNOWN_ES )
+                if( !tk->b_configured && tk->fmt.i_cat != UNKNOWN_ES )
                 {
-                    tk->es = es_out_Add( p_demux->out, &tk->fmt );
+                    if( tk->b_seen )
+                        tk->es = es_out_Add( p_demux->out, &tk->fmt );
+                     /* else create when seeing packet */
                     tk->b_configured = true;
                 }
             }
@@ -546,6 +548,12 @@ static int Demux( demux_t *p_demux )
                 }
             }
 
+            /* Late creation from system header */
+            if( !tk->b_seen && tk->b_configured && !tk->es && tk->fmt.i_cat != UNKNOWN_ES )
+                tk->es = es_out_Add( p_demux->out, &tk->fmt );
+
+            tk->b_seen = true;
+
             /* The popular VCD/SVCD subtitling WinSubMux does not
              * renumber the SCRs when merging subtitles into the PES */
             if( tk->b_seen && !p_sys->b_bad_scr &&
diff --git a/modules/demux/mpeg/ps.h b/modules/demux/mpeg/ps.h
index 4ff4395e30..71a79f6003 100644
--- a/modules/demux/mpeg/ps.h
+++ b/modules/demux/mpeg/ps.h
@@ -483,11 +483,8 @@ static inline int ps_pkt_parse_system( block_t *p_pkt, ps_psm_t *p_psm,
             continue;
 
         int i_tk = PS_ID_TO_TK( i_id );
-        if( !tk[i_tk].b_configured &&
-            !ps_track_fill( &tk[i_tk], p_psm, i_id, NULL, false ) )
-        {
-                tk[i_tk].b_configured = true;
-        }
+        if( !tk[i_tk].b_configured )
+            ps_track_fill( &tk[i_tk], p_psm, i_id, NULL, false );
     }
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list