[vlc-commits] demux: ogg: fix non xiph frame interpolation
Francois Cartegnie
git at videolan.org
Mon Dec 18 22:14:56 CET 2017
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 17 23:05:53 2017 +0100| [fde5147fc0d8c7858bbb94fbbed991c551af13a8] | committer: Francois Cartegnie
demux: ogg: fix non xiph frame interpolation
(cherry picked from commit ccd12d977191d57fd965500eaea95411f3a45943)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=fde5147fc0d8c7858bbb94fbbed991c551af13a8
---
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 be3cd839c8..087cdd048c 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1058,9 +1058,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 &&
@@ -1108,6 +1121,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