Commit 722b9d0e authored by Tobias Güntner's avatar Tobias Güntner Committed by Laurent Aimar

Fix prebuffering after seek.

Signed-off-by: default avatarLaurent Aimar <fenrir@videolan.org>
parent ee7c062a
...@@ -1428,13 +1428,14 @@ static void AStreamPrebufferStream( stream_t *s ) ...@@ -1428,13 +1428,14 @@ static void AStreamPrebufferStream( stream_t *s )
int64_t i_date = mdate(); int64_t i_date = mdate();
int i_read; int i_read;
int i_buffered = tk->i_end - tk->i_start;
if( s->b_die || tk->i_end >= STREAM_CACHE_PREBUFFER_SIZE ) if( s->b_die || i_buffered >= STREAM_CACHE_PREBUFFER_SIZE )
{ {
int64_t i_byterate; int64_t i_byterate;
/* Update stat */ /* Update stat */
p_sys->stat.i_bytes = tk->i_end - tk->i_start; p_sys->stat.i_bytes = i_buffered;
p_sys->stat.i_read_time = i_date - i_start; p_sys->stat.i_read_time = i_date - i_start;
i_byterate = ( INT64_C(1000000) * p_sys->stat.i_bytes ) / i_byterate = ( INT64_C(1000000) * p_sys->stat.i_bytes ) /
(p_sys->stat.i_read_time+1); (p_sys->stat.i_read_time+1);
...@@ -1448,9 +1449,9 @@ static void AStreamPrebufferStream( stream_t *s ) ...@@ -1448,9 +1449,9 @@ static void AStreamPrebufferStream( stream_t *s )
} }
/* */ /* */
i_read = STREAM_CACHE_TRACK_SIZE - tk->i_end; i_read = STREAM_CACHE_TRACK_SIZE - i_buffered;
i_read = __MIN( p_sys->stream.i_read_size, i_read ); i_read = __MIN( p_sys->stream.i_read_size, i_read );
i_read = AReadStream( s, &tk->p_buffer[tk->i_end], i_read ); i_read = AReadStream( s, &tk->p_buffer[i_buffered], i_read );
if( i_read < 0 ) if( i_read < 0 )
continue; continue;
else if( i_read == 0 ) else if( i_read == 0 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment