Skip to content

Commit

Permalink
udp: adjust receive buffer for windows 7 and earlier
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ilkka-ollakka committed Mar 20, 2015
1 parent 4aeccbd commit ca1e156
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/network/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit ca1e156

Please sign in to comment.