[vlc-devel] [PATCH] stream_filter: prefetch: early fail on seek

Francois Cartegnie fcvlcdev at free.fr
Wed Jul 27 19:54:29 CEST 2016


---
 modules/stream_filter/prefetch.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c
index 38d7937..3280810 100644
--- a/modules/stream_filter/prefetch.c
+++ b/modules/stream_filter/prefetch.c
@@ -255,15 +255,20 @@ static void *Thread(void *data)
 static int Seek(stream_t *stream, uint64_t offset)
 {
     stream_sys_t *sys = stream->p_sys;
+    int i_ret = 0;
 
     vlc_mutex_lock(&sys->lock);
-    if (sys->stream_offset != offset)
+    if(sys->size != (uint64_t)-1 && offset >= sys->size)
+    {
+        i_ret = -1;
+    }
+    else if (sys->stream_offset != offset)
     {
         sys->stream_offset = offset;
         vlc_cond_signal(&sys->wait_space);
     }
     vlc_mutex_unlock(&sys->lock);
-    return 0;
+    return i_ret;
 }
 
 static size_t BufferLevel(const stream_t *stream, bool *eof)
-- 
2.7.4



More information about the vlc-devel mailing list