[vlc-commits] demux: ogg: PTS to TICK_INVALID on missing interpolation

Francois Cartegnie git at videolan.org
Mon Feb 11 14:38:21 CET 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 11 12:50:12 2019 +0100| [edadd2849f840f117504f0bd1bd92b0b676ed223] | committer: Francois Cartegnie

demux: ogg: PTS to TICK_INVALID on missing interpolation

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

 modules/demux/ogg.c | 13 ++++++++++---
 modules/demux/ogg.h |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 671a3f7185..d310c42146 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -615,6 +615,7 @@ static void Ogg_ResetStream( logical_stream_t *p_stream )
     p_stream->b_reinit = true;
     p_stream->i_pcr = VLC_TICK_INVALID;
     p_stream->i_next_block_flags = 0;
+    p_stream->b_interpolation_failed = false;
     date_Set( &p_stream->dts, VLC_TICK_INVALID );
     ogg_stream_reset( &p_stream->os );
     block_ChainRelease( p_stream->queue.p_blocks );
@@ -976,7 +977,10 @@ static void Ogg_SetNextFrame( demux_t *p_demux, logical_stream_t *p_stream,
                     }
                     break;
             }
-            date_Increment( &p_stream->dts, i_samples );
+            if( i_samples == 0 )
+                p_stream->b_interpolation_failed = true;
+            else
+                date_Increment( &p_stream->dts, i_samples );
         }
     }
 }
@@ -1337,7 +1341,8 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     }
 
     vlc_tick_t i_dts = Ogg_GranuleToTime( p_stream, p_oggpacket->granulepos, true, false );
-    vlc_tick_t i_expected_dts = date_Get( &p_stream->dts ); /* Interpolated or previous end time */
+    vlc_tick_t i_expected_dts = p_stream->b_interpolation_failed ? VLC_TICK_INVALID :
+                                date_Get( &p_stream->dts ); /* Interpolated or previous end time */
     if( i_dts == VLC_TICK_INVALID )
         i_dts = i_expected_dts;
     else
@@ -1406,7 +1411,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     }
     else if( p_stream->fmt.i_cat == AUDIO_ES )
     {
-        p_block->i_pts = p_block->i_dts;
+        p_block->i_pts = p_stream->b_interpolation_failed ? VLC_TICK_INVALID : p_block->i_dts;
     }
     else if( p_stream->fmt.i_cat == SPU_ES )
     {
@@ -1414,6 +1419,8 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         p_block->i_pts = p_block->i_dts;
     }
 
+    p_stream->b_interpolation_failed = false;
+
     if( p_stream->b_oggds )
     {
         if( p_oggpacket->bytes <= 0 )
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index e8010cc51d..a8b56a85c3 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -60,6 +60,7 @@ typedef struct logical_stream_s
     es_out_id_t      *p_es;
     date_t           dts;
     bool             b_contiguous;              /* Granule is end of packet */
+    bool             b_interpolation_failed;    /* Don't use dts, it was not interpolated */
 
     int              i_serial_no;
 



More information about the vlc-commits mailing list