Commit f6a24478 authored by Filip Roséen's avatar Filip Roséen Committed by Thomas Guillem

stream_filter/cache_block: fix premature EOF

AStreamReadBlock would potentially return 0 because the current data block
(denoted by "p_sys->p_current") was exhausted, even though there might be more
data in the next data block ("p_sys->p_current->p_next").

At the place where this patch apply, `p_sys->p_current` has been set to
`p_sys->p_current->p_next`, so the pointer denotes the next block to
process (even though the name is rather misleading at that point).
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent b1a9cc98
......@@ -402,6 +402,16 @@ static ssize_t AStreamReadBlock(stream_t *s, void *buf, size_t len)
AStreamRefillBlock(s);
}
/**
* we should not signal end-of-file if we have not exhausted
* the blocks we know about, as such we should try again if that
* is the case. i_copy == 0 just means that the processed block does
* not contain data at the offset that we want, not EOF.
**/
if( i_copy == 0 && sys->p_current )
return AStreamReadBlock( s, buf, len );
sys->i_pos += i_copy;
return i_copy;
}
......
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