udp: Receive on the remote port number, if no local port is set
authorCan Wu <wu.canus@gmail.com>
Fri, 17 Jun 2011 05:58:01 +0000 (13:58 +0800)
committerMartin Storsjö <martin@martin.st>
Fri, 24 Jun 2011 15:27:02 +0000 (18:27 +0300)
For a unicast udp stream to localhost:1234, currently
ffplay udp://:1234?localport=1234
works, but
ffplay udp://:1234
doesn't work.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/udp.c

index d6522bf..724ff01 100644 (file)
@@ -365,7 +365,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
             goto fail;
     }
 
-    if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
+    if ((s->is_multicast || !s->local_port) && (h->flags & AVIO_FLAG_READ))
         s->local_port = port;
     udp_fd = udp_socket_create(s, &my_addr, &len);
     if (udp_fd < 0)