[vlc-devel] [PATCH] cache_read: don't fail when seeking at the end of the stream

Thomas Guillem thomas at gllm.fr
Thu Oct 15 11:45:48 CEST 2015


AStreamRefillStream shouldn't fail in case of EOF.
AStreamSeekStream shouldn't fail when no data can be cached after a seek.
---
 modules/stream_filter/cache_read.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/modules/stream_filter/cache_read.c b/modules/stream_filter/cache_read.c
index 5a32433..dd08eb2 100644
--- a/modules/stream_filter/cache_read.c
+++ b/modules/stream_filter/cache_read.c
@@ -116,9 +116,8 @@ static int AStreamRefillStream(stream_t *s)
     int i_toread =
         __MIN(sys->i_used, STREAM_CACHE_TRACK_SIZE -
                (tk->i_end - tk->i_start - sys->i_offset));
-    bool b_read = false;
 
-    if (i_toread <= 0) return VLC_EGENERIC; /* EOF */
+    if (i_toread <= 0) return VLC_SUCCESS; /* EOF */
 
 #ifdef STREAM_DEBUG
     msg_Dbg(s, "AStreamRefillStream: used=%d toread=%d",
@@ -143,12 +142,7 @@ static int AStreamRefillStream(stream_t *s)
             continue;
         }
         else if (i_read == 0)
-        {
-            if (!b_read)
-                return VLC_EGENERIC;
             return VLC_SUCCESS;
-        }
-        b_read = true;
 
         /* Update end */
         tk->i_end += i_read;
@@ -434,7 +428,7 @@ static int AStreamSeekStream(stream_t *s, uint64_t i_pos)
         if (sys->i_used < STREAM_READ_ATONCE / 2)
             sys->i_used = STREAM_READ_ATONCE / 2;
 
-        if (AStreamRefillStream(s) && i_pos >= tk->i_end)
+        if (AStreamRefillStream(s))
             return VLC_EGENERIC;
     }
     return VLC_SUCCESS;
-- 
2.1.4



More information about the vlc-devel mailing list