X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Finput%2Fstream.c;h=019e5c00dd37e238895bd846897dffcd7c1704f8;hb=5d6c8137d529c3efb773339d65367c954251eb43;hp=567c11593e929f9617cb729bf6642f08814654b4;hpb=e2a614c82b502ea6c3cdee7d0fc39cbb9627041e;p=vlc diff --git a/src/input/stream.c b/src/input/stream.c index 567c11593e..019e5c00dd 100644 --- a/src/input/stream.c +++ b/src/input/stream.c @@ -512,6 +512,7 @@ static void AStreamDestroy( stream_t *s ) vlc_object_detach( s ); if( p_sys->method == Block ) block_ChainRelease( p_sys->block.p_first ); + else if ( p_sys->method == Immediate ) free( p_sys->immediate.p_buffer ); else free( p_sys->stream.p_buffer ); free( p_sys->p_peek ); @@ -995,19 +996,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;