[FFmpeg-cvslog] avformat/udp: cleanup comments, add a warning if receive buffer is unexpectedly unable to be set high enough

rogerdpack git at videolan.org
Sat Mar 22 16:45:51 CET 2014


ffmpeg | branch: master | rogerdpack <rogerpack2005 at gmail.com> | Fri Mar 21 17:37:42 2014 -0600| [0b4c5c99bc6f028cc64a7d35e1068b982544d833] | committer: Michael Niedermayer

avformat/udp: cleanup comments, add a warning if receive buffer is unexpectedly unable to be set high enough

which can happen easily in linux

Signed-off-by: rogerdpack <rogerpack2005 at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b4c5c99bc6f028cc64a7d35e1068b982544d833
---

 libavformat/udp.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index a61ac33..d9a18d5 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -695,8 +695,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
             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. */
+        /* set udp recv buffer size to the requested value (default 64K) */
         tmp = s->buffer_size;
         if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
             log_net_error(h, AV_LOG_WARNING, "setsockopt(SO_RECVBUF)");
@@ -704,8 +703,11 @@ static int udp_open(URLContext *h, const char *uri, int flags)
         len = sizeof(tmp);
         if (getsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, &len) < 0) {
             log_net_error(h, AV_LOG_WARNING, "getsockopt(SO_RCVBUF)");
-        } else
+        } else {
             av_log(h, AV_LOG_DEBUG, "end receive buffer size reported is %d\n", tmp);
+            if(tmp < s->buffer_size)
+                av_log(h, AV_LOG_WARNING, "attempted to set receive buffer to size %d but it only ended up set as %d", s->buffer_size, tmp);
+        }
 
         /* make the socket non-blocking */
         ff_socket_nonblock(udp_fd, 1);



More information about the ffmpeg-cvslog mailing list