[vlc-commits] stream_filter/cache_block: fix premature EOF
Filip Roséen
git at videolan.org
Sun Jun 5 13:02:15 CEST 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Sat Jun 4 14:52:04 2016 +0200| [f6a2447848c49b45e26793c0198f8402781f5a49] | committer: 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 <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f6a2447848c49b45e26793c0198f8402781f5a49
---
modules/stream_filter/cache_block.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/stream_filter/cache_block.c b/modules/stream_filter/cache_block.c
index dc31506..7695fac 100644
--- a/modules/stream_filter/cache_block.c
+++ b/modules/stream_filter/cache_block.c
@@ -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;
}
More information about the vlc-commits
mailing list