[vlc-commits] demux: ogg: do PCR handling on stream boundary

Francois Cartegnie git at videolan.org
Sun Dec 22 20:07:44 CET 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 22 20:05:14 2013 +0100| [6ab6d20b15fde4cd529742d8df2fec4beaac6846] | committer: Francois Cartegnie

demux: ogg: do PCR handling on stream boundary

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

 modules/demux/ogg.c |   19 ++++++++++++++++++-
 modules/demux/ogg.h |    4 ++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 62513d1..f1aece1 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -266,6 +266,7 @@ static int Demux( demux_t * p_demux )
                 TAB_CLEAN( p_sys->i_streams, p_sys->pp_stream );
             }
             Ogg_EndOfStream( p_demux );
+            p_sys->b_chained_boundary = true;
         }
 
         if( Ogg_BeginningOfStream( p_demux ) != VLC_SUCCESS )
@@ -277,7 +278,13 @@ static int Demux( demux_t * p_demux )
             Oggseek_ProbeEnd( p_demux );
 
         msg_Dbg( p_demux, "beginning of a group of logical streams" );
-        es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 );
+        if ( p_sys->b_chained_boundary )
+        {
+            es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
+            p_sys->b_chained_boundary = false;
+        }
+        else
+            es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 );
     }
 
     if ( p_sys->b_preparsing_done )
@@ -1287,6 +1294,12 @@ static void Ogg_DecodePacket( demux_t *p_demux,
             p_block->i_buffer = 0;
     }
 
+    if ( p_stream->b_reusing )
+    {
+        p_stream->b_reusing = false;
+        p_block->i_flags |= BLOCK_FLAG_DISCONTINUITY;
+    }
+
     if( p_stream->fmt.i_codec == VLC_CODEC_TARKIN )
     {
         /* FIXME: the biggest hack I've ever done */
@@ -1854,6 +1867,10 @@ static void Ogg_CreateES( demux_t *p_demux )
                 msg_Dbg( p_demux, "will reuse old stream to avoid glitch" );
 
                 p_stream->p_es = p_old_stream->p_es;
+                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 );
 
                 p_old_stream->p_es = NULL;
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index 7f59567..a2d547a 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -75,6 +75,7 @@ typedef struct logical_stream_s
     bool b_initializing;
     bool b_finished;
     bool b_reinit;
+    bool b_reusing;
     bool b_oggds;
     int i_granule_shift;
 
@@ -133,6 +134,9 @@ struct demux_sys_t
      * the sub-streams */
     mtime_t i_pcr;
 
+    /* new stream or starting from a chain */
+    bool b_chained_boundary;
+
     /* bitrate */
     int     i_bitrate;
     bool    b_partial_bitrate;



More information about the vlc-commits mailing list