diff mbox

[FFmpeg-devel] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.

Message ID SG2PR0201MB0933C55D59E909968C006633A5EA0@SG2PR0201MB0933.apcprd02.prod.outlook.com
State Superseded
Headers show

Commit Message

liu jc Aug. 24, 2016, 9:17 a.m. UTC
Signed-off-by: liujingchao <jcliu@outlook.com>
---
 libavformat/tcp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
 mode change 100644 => 100755 libavformat/tcp.c

Comments

Nicolas George Aug. 24, 2016, 9:22 a.m. UTC | #1
L'octidi 8 fructidor, an CCXXIV, liu jc a écrit :
> Signed-off-by: liujingchao <jcliu@outlook.com>
> ---
>  libavformat/tcp.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>  mode change 100644 => 100755 libavformat/tcp.c
> 
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> old mode 100644
> new mode 100755
> index c105479..289bcd8
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -122,6 +122,17 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
>      cur_ai = ai;
>  
>   restart:
> +    
> +    if (cur_ai->ai_family == AF_INET6)
> +    {
> +        struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
> +        if (sockaddr_v6->sin6_port == 0)
> +        {
> +            sockaddr_v6->sin6_port = htons(port);
> +        }
> +    }

Please respect the surrounding coding style.

From my point of view, this is dead code that can be removed. A comment is
needed to avoid that.

> +   

Trailing spaces are forbidden; tools/patcheck would have noticed it.

> +	

Id do not think we need two empty lines here.

>      fd = ff_socket(cur_ai->ai_family,
>                     cur_ai->ai_socktype,
>                     cur_ai->ai_protocol);

Regards,
diff mbox

Patch

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
old mode 100644
new mode 100755
index c105479..289bcd8
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -122,6 +122,17 @@  static int tcp_open(URLContext *h, const char *uri, int flags)
     cur_ai = ai;
 
  restart:
+    
+    if (cur_ai->ai_family == AF_INET6)
+    {
+        struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr;
+        if (sockaddr_v6->sin6_port == 0)
+        {
+            sockaddr_v6->sin6_port = htons(port);
+        }
+    }
+    
+	
     fd = ff_socket(cur_ai->ai_family,
                    cur_ai->ai_socktype,
                    cur_ai->ai_protocol);