[vlc-devel] [PATCH] smb2: limit the read size

Thomas Guillem thomas at gllm.fr
Thu Feb 6 16:29:54 CET 2020


This fixes slow probing/seeking when using prefetch since it requests big data
size (16MB) for each read().
---
 modules/access/smb2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 3c3d4ff1415..b7ec017807c 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -241,6 +241,12 @@ FileRead(stream_t *access, void *buf, size_t len)
     if (sys->eof)
         return 0;
 
+    /* Limit the read size since smb2_read_async() will complete only after
+     * reading the whole requested data and not when whatever data is
+     * available. */
+    if (len > 32768)
+        len = 32768;
+
     sys->res.read.len = 0;
     if (smb2_read_async(sys->smb2, sys->smb2fh, buf, len,
                         smb2_read_cb, access) < 0)
-- 
2.20.1



More information about the vlc-devel mailing list