Commit 0fa5425b authored by Ilkka Ollakka's avatar Ilkka Ollakka

udp: adjust receive buffer for windows 7 and earlier

Try to detect runtime what windows version it is running to see if
receive buffers should be increased or leave to OS handling.
Fixes #14200

(cherry picked from commit ca1e15692ce9acc2d421c302434efd10eec64d27)
Signed-off-by: default avatarIlkka Ollakka <ileoo@videolan.org>
parent 284eecda
......@@ -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 earlier
* SetSocketMediaStreamingMode is present in win 8 and later, so we set
* receive buffer if that isn't present
*/
HINSTANCE h_Network = LoadLibraryW(L"Windows.Networking.dll");
if( (h_Network == NULL) ||
(GetProcAddress( h_Network, "SetSocketMediaStreamingMode" ) == NULL ) )
{
setsockopt (fd, SOL_SOCKET, SO_RCVBUF,
(void *)&(int){ 0x80000 }, sizeof (int));
}
if( h_Network )
FreeLibrary( h_Network );
if (net_SockAddrIsMulticast (ptr->ai_addr, ptr->ai_addrlen)
&& (sizeof (struct sockaddr_storage) >= ptr->ai_addrlen))
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment