# HG changeset patch # User lucabe # Date 1193815658 0 # Node ID 7d25b8de708d205d8cd257ce80d9ad91b5db4eb3 # Parent fffdcae6654cfa7fc2d2fbfa4285f8e9e0470197 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) diff -r fffdcae6654c -r 7d25b8de708d udp.c --- a/udp.c Wed Oct 31 07:08:12 2007 +0000 +++ b/udp.c Wed Oct 31 07:27:38 2007 +0000 @@ -153,8 +153,11 @@ char sbuf[NI_MAXSERV]; char hbuf[NI_MAXHOST]; 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) goto fail; for (res = res0; res; res=res->ai_next) { @@ -277,7 +280,7 @@ is_output = (flags & URL_WRONLY); - s = av_malloc(sizeof(UDPContext)); + s = av_mallocz(sizeof(UDPContext)); if (!s) return AVERROR(ENOMEM);