[vlc-devel] [PATCH] Allow ogg to send VLC_TS_INVALID when used as slave

Denis Charmet typx at dinauz.org
Sun Sep 3 15:38:00 CEST 2017


From: Denis Charmet <typx at videolan.org>

Fix #18757
---
 modules/demux/ogg.c | 15 +++++++++++----
 modules/demux/ogg.h |  2 ++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 1b76c6fde7..3dde0243f4 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -321,7 +321,8 @@ static int Demux( demux_t * p_demux )
             if( i_lastpcr > VLC_TS_INVALID )
             {
                 p_sys->i_nzpcr_offset = i_lastpcr - VLC_TS_0;
-                es_out_SetPCR( p_demux->out, i_lastpcr );
+                if( likely( !p_sys->b_slave ) )
+                    es_out_SetPCR( p_demux->out, i_lastpcr );
             }
             p_sys->i_pcr = VLC_TS_INVALID;
         }
@@ -691,7 +692,8 @@ static int Demux( demux_t * p_demux )
         if( ! b_skipping && p_sys->b_preparsing_done )
         {
             p_sys->i_pcr = i_pcr_candidate;
-            es_out_SetPCR( p_demux->out, p_sys->i_pcr );
+            if( likely( !p_sys->b_slave ) )
+                es_out_SetPCR( p_demux->out, p_sys->i_pcr );
         }
     }
 
@@ -782,8 +784,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             *pb_bool = true;
             return VLC_SUCCESS;
 
+        case DEMUX_SET_NEXT_DEMUX_TIME:
+            p_sys->b_slave = true;
+            return VLC_EGENERIC;
+
         case DEMUX_GET_TIME:
-            if( p_sys->i_pcr > VLC_TS_INVALID )
+            if( p_sys->i_pcr > VLC_TS_INVALID || p_sys->b_slave )
             {
                 pi64 = va_arg( args, int64_t * );
                 *pi64 = p_sys->i_pcr;
@@ -1161,7 +1167,8 @@ static void Ogg_SendOrQueueBlocks( demux_t *p_demux, logical_stream_t *p_stream,
                 if ( p_ogg->i_pcr < VLC_TS_0 && i_firstpts > VLC_TS_INVALID )
                 {
                     p_ogg->i_pcr = i_firstpts;
-                    es_out_SetPCR( p_demux->out, p_ogg->i_pcr );
+                    if( likely( !p_ogg->b_slave ) )
+                        es_out_SetPCR( p_demux->out, p_ogg->i_pcr );
                 }
             }
             p_stream->p_preparse_block = NULL;
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index 872bbd97b2..16ac99793c 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -232,6 +232,8 @@ struct demux_sys_t
     /* Length, if available. */
     int64_t i_length;
 
+    bool b_slave;
+
 };
 
 
-- 
2.14.1



More information about the vlc-devel mailing list