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

Thomas Guillem git at videolan.org
Thu Oct 22 11:01:32 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 15 11:45:48 2015 +0200| [91b2daf8c840603e843e5e5268fbdf80523285e3] | committer: Thomas Guillem

cache_read: don't fail when seeking at the end of the stream

AStreamRefillStream shouldn't fail in case of EOF.
AStreamSeekStream shouldn't fail when no data can be cached after a seek.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91b2daf8c840603e843e5e5268fbdf80523285e3
---

 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 2251e18..ee21d7c 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;
@@ -443,7 +437,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;



More information about the vlc-commits mailing list