]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Set UDP receive buffer to 64k
authorramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 16 Aug 2007 22:12:03 +0000 (22:12 +0000)
committerramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 16 Aug 2007 22:12:03 +0000 (22:12 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10129 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/udp.c

index edbf543ba946b939e1fc24e7aaea713dea82e535..d0aadcefc8ad57097b61306d613470eb6caedc72 100644 (file)
@@ -43,6 +43,7 @@ typedef struct {
 } UDPContext;
 
 #define UDP_TX_BUF_SIZE 32768
+#define UDP_MAX_PKT_SIZE 65536
 
 #ifdef CONFIG_IPV6
 
@@ -396,6 +397,11 @@ static int udp_open(URLContext *h, const char *uri, int flags)
             perror("setsockopt sndbuf");
             goto fail;
         }
+    } else {
+        /* set udp recv buffer size to the largest possible udp packet size to
+         * avoid losing data on OSes that set this too low by default. */
+        tmp = UDP_MAX_PKT_SIZE;
+        setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp));
     }
 
     s->udp_fd = udp_fd;