[FFmpeg-cvslog] avformat/tcp: workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.
liu jc
git at videolan.org
Sat Nov 5 19:48:29 EET 2016
ffmpeg | branch: master | liu jc <jcliu at outlook.com> | Wed Aug 24 10:46:41 2016 +0000| [c0f6eff6a7edaa38a9ea4865ffc2ad36539d9d48] | committer: Michael Niedermayer
avformat/tcp: workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.
Signed-off-by: liujingchao <jcliu at outlook.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0f6eff6a7edaa38a9ea4865ffc2ad36539d9d48
---
libavformat/tcp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index c105479..fd10a56 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -122,6 +122,14 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
cur_ai = ai;
restart:
+ // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.
+ if (cur_ai->ai_family == AF_INET6){
+ struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
+ if (!sockaddr_v6->sin6_port){
+ sockaddr_v6->sin6_port = htons(port);
+ }
+ }
+
fd = ff_socket(cur_ai->ai_family,
cur_ai->ai_socktype,
cur_ai->ai_protocol);
More information about the ffmpeg-cvslog
mailing list