Commit 59bfb30e authored by lucabe's avatar lucabe

Take the target address family in account when determining the family of

the local address to bind.
Fixes ffserver and UDP streaming without --disable-ipv6 on MacOS X

Patch by Ronald S. Bultje (rsbultje st gmail dot com)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10883 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 5eaf7fd1
...@@ -153,8 +153,11 @@ static int udp_ipv6_set_local(URLContext *h) { ...@@ -153,8 +153,11 @@ static int udp_ipv6_set_local(URLContext *h) {
char sbuf[NI_MAXSERV]; char sbuf[NI_MAXSERV];
char hbuf[NI_MAXHOST]; char hbuf[NI_MAXHOST];
struct addrinfo *res0 = NULL, *res = NULL; struct addrinfo *res0 = NULL, *res = NULL;
int family = AF_UNSPEC;
res0 = udp_ipv6_resolve_host(0, s->local_port, SOCK_DGRAM, AF_UNSPEC, AI_PASSIVE); if (((struct sockaddr *) &s->dest_addr)->sa_family)
family = ((struct sockaddr *) &s->dest_addr)->sa_family;
res0 = udp_ipv6_resolve_host(0, s->local_port, SOCK_DGRAM, family, AI_PASSIVE);
if (res0 == 0) if (res0 == 0)
goto fail; goto fail;
for (res = res0; res; res=res->ai_next) { for (res = res0; res; res=res->ai_next) {
...@@ -277,7 +280,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) ...@@ -277,7 +280,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
is_output = (flags & URL_WRONLY); is_output = (flags & URL_WRONLY);
s = av_malloc(sizeof(UDPContext)); s = av_mallocz(sizeof(UDPContext));
if (!s) if (!s)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment