[vlc-commits] demux: ogg: fix broken bisection on invalid granule
Francois Cartegnie
git at videolan.org
Thu Mar 15 22:59:01 CET 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Mar 15 22:43:23 2018 +0100| [1aaa17eb9da94559182c67874c34ad4ea70b3338] | committer: Francois Cartegnie
demux: ogg: fix broken bisection on invalid granule
happens when seeking outside of stream/on new stream ahead
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1aaa17eb9da94559182c67874c34ad4ea70b3338
---
modules/demux/ogg.c | 3 +--
modules/demux/oggseek.c | 9 ++++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 4a58c26598..ff2610d1e5 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -875,8 +875,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if ( p_sys->i_length <= 0 || !b /* || ! STREAM_CAN_FASTSEEK */ )
{
Ogg_ResetStreamsHelper( p_sys );
- Oggseek_BlindSeektoPosition( p_demux, p_stream, f, b );
- return VLC_SUCCESS;
+ return Oggseek_BlindSeektoPosition( p_demux, p_stream, f, b );
}
assert( p_sys->i_length > 0 );
diff --git a/modules/demux/oggseek.c b/modules/demux/oggseek.c
index ecb4c01087..2d4a2b6547 100644
--- a/modules/demux/oggseek.c
+++ b/modules/demux/oggseek.c
@@ -950,6 +950,7 @@ int Oggseek_BlindSeektoPosition( demux_t *p_demux, logical_stream_t *p_stream,
demux_sys_t *p_sys = p_demux->p_sys;
OggDebug( msg_Dbg( p_demux, "=================== Seeking To Blind Pos" ) );
int64_t i_size = stream_Size( p_demux->s );
+ uint64_t i_startpos = vlc_stream_Tell( p_demux->s );
int64_t i_granule;
int64_t i_pagepos;
@@ -957,6 +958,12 @@ int Oggseek_BlindSeektoPosition( demux_t *p_demux, logical_stream_t *p_stream,
i_size * f, i_size,
p_stream,
&i_granule );
+ if( i_granule == -1 )
+ {
+ if( vlc_stream_Seek( p_demux->s, i_startpos ) != VLC_SUCCESS )
+ msg_Err( p_demux, "Seek back failed. Not seekable ?" );
+ return VLC_EGENERIC;
+ }
OggDebug( msg_Dbg( p_demux, "Seek start pos is %"PRId64" granule %"PRId64, i_size, i_granule ) );
@@ -981,7 +988,7 @@ int Oggseek_BlindSeektoPosition( demux_t *p_demux, logical_stream_t *p_stream,
}
OggDebug( msg_Dbg( p_demux, "=================== Seeked To %"PRId64" granule %"PRId64, i_pagepos, i_granule ) );
- return i_pagepos;
+ return VLC_SUCCESS;
}
int Oggseek_SeektoAbsolutetime( demux_t *p_demux, logical_stream_t *p_stream,
More information about the vlc-commits
mailing list