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

Thomas Guillem thomas at gllm.fr
Fri Feb 7 18:54:12 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 3c3d4ff141..10b78fe67d 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 > 262144)
+        len = 262144;
+
     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