[vlc-devel] [PATCH] udp: adjust receive buffer for windows 7 and earlier

Ilkka Ollakka ileoo at videolan.org
Thu Mar 19 14:28:56 CET 2015


Try to detect runtime our windows version.
Fixes #14200
---
 src/network/udp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/network/udp.c b/src/network/udp.c
index b2c8a50..98bae46 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -97,6 +97,21 @@ static int net_SetupDgramSocket (vlc_object_t *p_obj, int fd,
 #endif
 
 #if defined (_WIN32)
+
+    /* Check windows version so we know if we need to increase receive buffers
+     * for Windows 7 and ealier
+
+     * SetSocketMediaStreamingMode is present in win 8 and later, so we set
+     * receive buffer if that isn't present
+     */
+    if( dlsym( RTLD_DEFAULT, "SetSocketMediaStreamingMode" ) == NULL )
+    {
+        setsockopt (fd, SOL_SOCKET, SO_RCVBUF,
+                         (void *)&(int){ 0x80000 }, sizeof (int));
+    }
+    /* Cleanup the dlsym possible error state */
+    dlerror();
+
     if (net_SockAddrIsMulticast (ptr->ai_addr, ptr->ai_addrlen)
      && (sizeof (struct sockaddr_storage) >= ptr->ai_addrlen))
     {
-- 
2.3.3




More information about the vlc-devel mailing list