[vlc-commits] smb2: limit the read size

Thomas Guillem git at videolan.org
Mon Feb 10 10:24:32 CET 2020


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb  7 18:54:12 2020 +0100| [2cad645b3d65e3ff2f34737867ac33232126aff7] | committer: Thomas Guillem

smb2: limit the read size

This fixes slow probing/seeking when using prefetch since it requests big data
size (16MB) for each read().

(cherry picked from commit 083a78510ea85023f861932047d920bddb0f091d)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2cad645b3d65e3ff2f34737867ac33232126aff7
---

 modules/access/smb2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index d86e73166e..25268cd90f 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
+     * (high read size means a faster I/O but a higher latency). */
+    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)



More information about the vlc-commits mailing list