[vlc-commits] demux: ogg: fix non xiph frame interpolation

Francois Cartegnie git at videolan.org
Mon Dec 18 22:12:11 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 17 23:05:53 2017 +0100| [ccd12d977191d57fd965500eaea95411f3a45943] | committer: Francois Cartegnie

demux: ogg: fix non xiph frame interpolation

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

 modules/demux/ogg.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 55f398a0d9..496354d654 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1064,9 +1064,22 @@ static void Ogg_UpdatePCR( demux_t *p_demux, logical_stream_t *p_stream,
         unsigned i_duration;
         /* no granulepos available, try to interpolate the pcr.
          * If we can't then don't touch the old value. */
-        if( p_stream->fmt.i_cat == VIDEO_ES && p_stream->i_pcr > VLC_TS_INVALID )
+        if( p_stream->b_oggds && p_stream->fmt.i_cat == VIDEO_ES )
         {
-            p_stream->i_pcr += (CLOCK_FREQ / p_stream->f_rate);
+            if( p_stream->i_previous_granulepos > 0 )
+            {
+                p_stream->i_pcr = VLC_TS_0 + p_stream->i_previous_granulepos * CLOCK_FREQ / p_stream->f_rate;
+                p_stream->i_pcr += p_ogg->i_nzpcr_offset;
+            }
+            /* First frame in ogm can be -1 (0 0 -1 2 3 -1 5 ...) */
+            else if( p_stream->i_previous_granulepos == 0 )
+            {
+                p_stream->i_pcr = VLC_TS_0 + p_ogg->i_nzpcr_offset;
+            }
+            else
+            {
+                p_stream->i_pcr += (CLOCK_FREQ / p_stream->f_rate);
+            }
         }
 #ifdef HAVE_LIBVORBIS
         else if ( p_stream->fmt.i_codec == VLC_CODEC_VORBIS &&
@@ -1114,6 +1127,10 @@ static void Ogg_UpdatePCR( demux_t *p_demux, logical_stream_t *p_stream,
             p_stream->i_pcr = VLC_TS_0 + sample * CLOCK_FREQ / p_stream->f_rate;
             p_stream->i_pcr += p_ogg->i_nzpcr_offset;
         }
+        else if( p_stream->fmt.i_cat == VIDEO_ES && p_stream->i_pcr > VLC_TS_UNKNOWN )
+        {
+            p_stream->i_pcr += (CLOCK_FREQ / p_stream->f_rate);
+        }
         else if( p_stream->fmt.i_bitrate && p_stream->i_pcr > VLC_TS_UNKNOWN )
         {
             p_stream->i_pcr += ( CLOCK_FREQ * p_oggpacket->bytes /



More information about the vlc-commits mailing list