Commit 321fa90d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Felix Paul Kühne

stream: handle seek across EOF correctly (hopefully)

(cherry picked from commit 6419254f5bb5ae06b72c93c9b52cd0a3bbbacb94)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent ce51ba40
......@@ -1083,15 +1083,15 @@ static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int
/* Be sure we will read something */
p_sys->stream.i_used += tk->i_start + p_sys->stream.i_offset + i_read - tk->i_end;
}
if( AStreamRefillStream( s ) ) break;
}
if( tk->i_end < tk->i_start + p_sys->stream.i_offset + i_read )
{
i_read = tk->i_end - tk->i_start - p_sys->stream.i_offset;
if( AStreamRefillStream( s ) )
{
if( tk->i_end < tk->i_start + p_sys->stream.i_offset )
return 0; /* EOF */
i_read = tk->i_end - tk->i_start - p_sys->stream.i_offset;
break;
}
}
/* Now, direct pointer or a copy ? */
i_off = (tk->i_start + p_sys->stream.i_offset) % STREAM_CACHE_TRACK_SIZE;
if( i_off + i_read <= STREAM_CACHE_TRACK_SIZE )
......
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