[vlc-commits] demux: ogg: don't recreate decoders on same chained streams.

Francois Cartegnie git at videolan.org
Mon Dec 23 00:42:44 CET 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 23 00:26:40 2013 +0100| [1f9c34275de478339dc4d750b8c62f1019303897] | committer: Francois Cartegnie

demux: ogg: don't recreate decoders on same chained streams.

SET_ES_FMT recreates decoders and then triggers preroll.

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

 modules/demux/ogg.c |   18 +++++++++++++-----
 modules/demux/ogg.h |    2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 4fea06a..839672a 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1296,9 +1296,9 @@ static void Ogg_DecodePacket( demux_t *p_demux,
             p_block->i_buffer = 0;
     }
 
-    if ( p_stream->b_reusing )
+    if ( p_stream->b_reusing_with_other_fmt )
     {
-        p_stream->b_reusing = false;
+        p_stream->b_reusing_with_other_fmt = false;
         p_block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
     }
 
@@ -1872,13 +1872,19 @@ static void Ogg_CreateES( demux_t *p_demux )
                 p_stream->b_finished = false;
                 p_stream->b_reinit = false;
                 p_stream->b_initializing = false;
-                p_stream->b_reusing = true;
+
                 es_format_Copy( &p_stream->fmt_old, &p_old_stream->fmt );
 
+                if ( !es_format_IsSimilar( &p_stream->fmt_old, &p_old_stream->fmt ) )
+                {
+                    msg_Dbg( p_demux, "recreating decoders using SET_FMT" );
+                    es_out_Control( p_demux->out, ES_OUT_SET_ES_FMT,
+                                    p_stream->p_es, &p_stream->fmt );
+                    p_stream->b_reusing_with_other_fmt = true;
+                }
+
                 p_old_stream->p_es = NULL;
                 p_old_stream = NULL;
-                es_out_Control( p_demux->out, ES_OUT_SET_ES_FMT,
-                                p_stream->p_es, &p_stream->fmt );
             }
             else
             {
@@ -1903,6 +1909,8 @@ static void Ogg_CreateES( demux_t *p_demux )
     }
 }
 
+
+
 /****************************************************************************
  * Ogg_BeginningOfStream: Look for Beginning of Stream ogg pages and add
  *                        Elementary streams.
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index a2d547a..3f527f9 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -75,7 +75,7 @@ typedef struct logical_stream_s
     bool b_initializing;
     bool b_finished;
     bool b_reinit;
-    bool b_reusing;
+    bool b_reusing_with_other_fmt;
     bool b_oggds;
     int i_granule_shift;
 



More information about the vlc-commits mailing list