---
 libavformat/tcp.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 7e348f7..c9ff47a 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -65,7 +65,12 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
     snprintf(portstr, sizeof(portstr), "%d", port);
-    ret = getaddrinfo(hostname, portstr, &hints, &ai);
+    if (listen_socket && !hostname[0]) {
+        hints.ai_flags |= AI_PASSIVE;
+        ret = getaddrinfo(NULL, portstr, &hints, &ai);
+    }
+    else
+        ret = getaddrinfo(hostname, portstr, &hints, &ai);
     if (ret) {
         av_log(h, AV_LOG_ERROR,
                "Failed to resolve hostname %s: %s\n",
-- 
1.7.10

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

Reply via email to