[vlc-devel] commit: Fixed stream_t (stream mode) read. (Laurent Aimar )
git version control
git at videolan.org
Sun Mar 8 15:01:52 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Mar 8 14:54:19 2009 +0100| [4b6976c1c0ca48a74a04b83b45554cbb932638d7] | committer: Laurent Aimar
Fixed stream_t (stream mode) read.
It fixes a growing amount of cache as noticed by Sébastien Escudier.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4b6976c1c0ca48a74a04b83b45554cbb932638d7
---
src/input/stream.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/input/stream.c b/src/input/stream.c
index ec25705..cf68932 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1101,11 +1101,15 @@ static int AStreamReadStream( stream_t *s, void *p_read, unsigned int i_read )
/* */
p_sys->stream.i_used += i_copy;
- if( tk->i_start + p_sys->stream.i_offset >= tk->i_end ||
- p_sys->stream.i_used >= p_sys->stream.i_read_size )
+
+ if( tk->i_end - tk->i_start - p_sys->stream.i_offset < i_read - i_data )
{
- if( p_sys->stream.i_used < i_read - i_data )
- p_sys->stream.i_used = __MIN( i_read - i_data, STREAM_READ_ATONCE * 10 );
+ const int i_read_requested = __MAX( __MIN( i_read - i_data,
+ STREAM_READ_ATONCE * 10 ),
+ STREAM_READ_ATONCE / 2 );
+
+ if( p_sys->stream.i_used < i_read_requested )
+ p_sys->stream.i_used = i_read_requested;
if( AStreamRefillStream( s ) )
{
@@ -1258,8 +1262,8 @@ static int AStreamSeekStream( stream_t *s, int64_t i_pos )
p_sys->stream.i_tk = i;
p_sys->stream.i_offset = i_pos - tk->i_start;
- if( p_sys->stream.i_used < 1024 )
- p_sys->stream.i_used = 1024;
+ if( p_sys->stream.i_used < STREAM_READ_ATONCE )
+ p_sys->stream.i_used = STREAM_READ_ATONCE;
if( AStreamRefillStream( s ) && i_pos == tk->i_end )
return VLC_EGENERIC;
More information about the vlc-devel
mailing list