[vlc-commits] demux: ogg: fix broken bisection on invalid granule
Francois Cartegnie
git at videolan.org
Sat Mar 17 20:32:26 CET 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Mar 15 22:43:23 2018 +0100| [4a2be36b43f9efc3cedd2cfc55dda3d9901282d5] | committer: Francois Cartegnie
demux: ogg: fix broken bisection on invalid granule
happens when seeking outside of stream/on new stream ahead
(cherry picked from commit 1aaa17eb9da94559182c67874c34ad4ea70b3338)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4a2be36b43f9efc3cedd2cfc55dda3d9901282d5
---
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 2e114dc394..3278947ffe 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 dec482f8fd..cb1adbb448 100644
--- a/modules/demux/oggseek.c
+++ b/modules/demux/oggseek.c
@@ -949,6 +949,7 @@ int Oggseek_BlindSeektoPosition( demux_t *p_demux, logical_stream_t *p_stream,
{
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;
@@ -956,6 +957,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 ) );
@@ -980,7 +987,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