- tmp = UDP_MAX_PKT_SIZE;
- setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp));
+ tmp = s->buffer_size;
+ if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
+ av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
+ }
+ /* make the socket non-blocking */
+ ff_socket_nonblock(udp_fd, 1);