From: Laurent Aimar Date: Thu, 3 Jul 2008 20:49:44 +0000 (+0000) Subject: Fixed AStreamSeekBlock. When skipping data, the position may not be the X-Git-Tag: 0.9.0-test2~295 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ac217da0399df26771fec3005f4faaa65a2eb34b;p=vlc Fixed AStreamSeekBlock. When skipping data, the position may not be the requested one. (Breaking at least mapped file input). --- diff --git a/src/input/stream.c b/src/input/stream.c index 567c11593e..d21eeb7af4 100644 --- a/src/input/stream.c +++ b/src/input/stream.c @@ -995,19 +995,21 @@ static int AStreamSeekBlock( stream_t *s, int64_t i_pos ) } else { - /* Read enough data */ - while( p_sys->block.i_start + p_sys->block.i_size < i_pos ) + do { + /* Read and skip enough data */ if( AStreamRefillBlock( s ) ) return VLC_EGENERIC; while( p_sys->block.p_current && - p_sys->i_pos + p_sys->block.p_current->i_buffer < i_pos ) + p_sys->i_pos + p_sys->block.p_current->i_buffer - p_sys->block.i_offset < i_pos ) { - p_sys->i_pos += p_sys->block.p_current->i_buffer; + p_sys->i_pos += p_sys->block.p_current->i_buffer - p_sys->block.i_offset; p_sys->block.p_current = p_sys->block.p_current->p_next; + p_sys->block.i_offset = 0; } } + while( p_sys->block.i_start + p_sys->block.i_size < i_pos ); p_sys->block.i_offset = i_pos - p_sys->i_pos; p_sys->i_pos = i_pos;