For a unicast udp streaming to localhost:1234, current
ffplay udp://:1234?localport=1234
working, but
ffplay udp://:1234
don't working.

So this small patch make the later working.

A problem, should  we check the localport parameter and use it?

Best Regards!

--
wucan

>From 806f863e2a1b8461fa01945a6d70843b6c7f5367 Mon Sep 17 00:00:00 2001
From: Can Wu <[email protected]>
Date: Fri, 17 Jun 2011 13:58:01 +0800
Subject: udp: direct use port in url when recv unicast stream

For a unicast udp streaming to localhost:1234, current
ffplay udp://:1234?localport=1234
working, but
ffplay udp://:1234
don't working.
---
 libavformat/udp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index d6522bf..0d679fd 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -367,6 +367,9 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 
     if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
         s->local_port = port;
+    /* unicast should bind to the port to make underline poll() working */
+    if ((!s->is_multicast) && (h->flags & AVIO_FLAG_READ))
+        s->local_port = port;
     udp_fd = udp_socket_create(s, &my_addr, &len);
     if (udp_fd < 0)
         goto fail;
-- 
1.7.3.2.168.gd6b63

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to