diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2007-10-31 07:27:38 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2007-10-31 07:27:38 +0000 |
commit | 51844e6cd2f2ef5876eae96d7d6f20ed5a0c4797 (patch) | |
tree | 4b183b4a6a50b796223192e429c7b0d1a64fd348 /libavformat/udp.c | |
parent | 7d8576c2792753b0903ab2e49f95da1dcf07afbf (diff) | |
download | ffmpeg-streaming-51844e6cd2f2ef5876eae96d7d6f20ed5a0c4797.zip ffmpeg-streaming-51844e6cd2f2ef5876eae96d7d6f20ed5a0c4797.tar.gz |
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)
Originally committed as revision 10883 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r-- | libavformat/udp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c index b33224a..c52d306 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -153,8 +153,11 @@ static int udp_ipv6_set_local(URLContext *h) { 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 @@ static int udp_open(URLContext *h, const char *uri, int flags) is_output = (flags & URL_WRONLY); - s = av_malloc(sizeof(UDPContext)); + s = av_mallocz(sizeof(UDPContext)); if (!s) return AVERROR(ENOMEM); |