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

Ilkka Ollakka ileoo at videolan.org
Thu Mar 19 07:59:33 CET 2015


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

diff --git a/src/network/udp.c b/src/network/udp.c
index b2c8a50..e83d746 100644
--- a/src/network/udp.c
+++ b/src/network/udp.c
@@ -97,6 +97,23 @@ 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*/
+    OSVERSIONINFOEXA osve;
+    memset(&osve, 0, sizeof(OSVERSIONINFOEXA));
+    osve.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEXA);
+    if(!GetVersionEx((POSVERSIONINFOA)&osve))
+    {
+        if( (osve.dwMajorVersion < 6) ||
+            ( (osve.dwMajorVersion == 6 ) &&
+              (osve.dwMinorVersion < 2 ) ) )
+        {
+            setsockopt (fd, SOL_SOCKET, SO_RCVBUF,
+                         (void *)&(int){ 0x80000 }, sizeof (int));
+        }
+    }
+
     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