[PATCH] Allow reuse of UDP addresses for read-only sockets by default, unless reuse=0 is specified

Martin Storsjo martin
Tue Oct 5 05:43:02 CEST 2010


---
 libavformat/udp.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index d30af57..5e4a1e8 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -310,10 +310,13 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     h->priv_data = s;
     s->ttl = 16;
     s->buffer_size = is_output ? UDP_TX_BUF_SIZE : UDP_MAX_PKT_SIZE;
+    s->reuse_socket = h->flags & URL_RDONLY;
 
     p = strchr(uri, '?');
     if (p) {
-        s->reuse_socket = find_info_tag(buf, sizeof(buf), "reuse", p);
+        if (find_info_tag(buf, sizeof(buf), "reuse", p)) {
+            s->reuse_socket = strtol(buf, NULL, 10);
+        }
         if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
             s->ttl = strtol(buf, NULL, 10);
         }
-- 
1.7.3.1


// Martin



More information about the ffmpeg-devel mailing list