[vlc-devel] [PATCH 1/2] cache_block: try to refill cache on read
Ilkka Ollakka
ileoo at videolan.org
Sat Apr 21 11:44:22 CEST 2018
If requested more data, than what is in cache, try to refill cache.
Regression from 9a725a039d8cfcf91aabad0101da1563a627493f
ref #20306
---
modules/stream_filter/cache_block.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/stream_filter/cache_block.c b/modules/stream_filter/cache_block.c
index e5b29a0055..f97bd8ea4b 100644
--- a/modules/stream_filter/cache_block.c
+++ b/modules/stream_filter/cache_block.c
@@ -185,12 +185,17 @@ static ssize_t AStreamReadBlock(stream_t *s, void *buf, size_t len)
stream_sys_t *sys = s->p_sys;
/* It means EOF */
- if (sys->cache.p_chain== NULL)
+ if (sys->cache.p_chain == NULL)
return 0;
ssize_t i_current = block_BytestreamRemaining( &sys->cache );
size_t i_copy = VLC_CLIP((size_t)i_current, 0, len);
+ /* If there was request for more data than what is in cache,
+ * try to refill cache */
+ if( i_copy < len )
+ AStreamRefillBlock(s);
+
/* Copy data */
if( block_GetBytes( &sys->cache, buf, i_copy ) )
return -1;
--
2.16.3
More information about the vlc-devel
mailing list