[FFmpeg-devel] 答复: [PATCH] IOS-IPv6-only-network-use-hardcode-IPv4-fix

Steven Liu lingjiujianke at gmail.com
Wed Aug 24 05:46:35 EEST 2016


2016-08-24 10:40 GMT+08:00 liu jc <jcliu at outlook.com>:

> this  patch just deal with the standard condition (most people use 1935).
> Although you still can use  the port and service map in mac (/etc/services)
> to cheat. If you rtmp server listen 1936 following the mac services list
> you can just pass a
>
> service name "jetcmeserver" then you tcp connection can establish
> successful.  But for not resulting ambiguity it is recommend use standard
> port number for specific service.
>
But without this patch, i can publish stream to rtmp server listening 1936
or other.

>
>
> ________________________________
> 发件人: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> 代表 Steven Liu <
> lingjiujianke at gmail.com>
> 发送时间: 2016年8月24日 1:34
> 收件人: FFmpeg development discussions and patches
> 主题: Re: [FFmpeg-devel] [PATCH] IOS-IPv6-only-network-use-hardcode-IPv4-fix
>
> 2016-08-24 9:03 GMT+08:00 liu jc <jcliu at outlook.com>:
>
> >
> >  there is a bug when useing getaddrinfo in IOS when use
> >  hardcode IPv4 address and in IPv6-only networks.It can not
> >  accept a port number as second parameter as an alternative
> >  you can pass a service name  or it will cause connect fail.
> >  In current video CDN dispatching mechanism the hardcode
> >  IPv4 is widly used for better performance. This problem
> >  cause many APP use ffmpeg to play this type CDN dispatched
> >  video were rejected by APP store. This patch fix this by
> >  adding a port to name map for widly used port number that
> >  these CDN use to dispatch video.
> >
> > ---
> >  libavformat/tcp.c |   17 +++++++++++++++--
> >  1 file changed, 15 insertions(+), 2 deletions(-)
> >  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..0de7710
> > --- a/libavformat/tcp.c
> > +++ b/libavformat/tcp.c
> > @@ -72,7 +72,7 @@ static int tcp_open(URLContext *h, const char *uri, int
> > flags)
> >      char buf[256];
> >      int ret;
> >      char hostname[1024],proto[1024],path[1024];
> > -    char portstr[10];
> > +    char portstr[64];
> >      s->open_timeout = 5000000;
> >
> >      av_url_split(proto, sizeof(proto), NULL, 0, hostname,
> > sizeof(hostname),
> > @@ -105,7 +105,19 @@ static int tcp_open(URLContext *h, const char *uri,
> > int flags)
> >      }
> >      hints.ai_family = AF_UNSPEC;
> >      hints.ai_socktype = SOCK_STREAM;
> > -    snprintf(portstr, sizeof(portstr), "%d", port);
> > +
> > +       switch (port) {
> > +        case 80:
> > +            snprintf(portstr, sizeof(portstr), "%s", "http");
> > +            break;
> > +        case 1935:
> > +            snprintf(portstr, sizeof(portstr), "%s", "macromedia-fcs");
> > //know as rtmp
> >
> i have one quetion: When the rtmp server listen the port 1936, what about
> the portstr?
>
> > +            break;
> > +        default:
> > +            snprintf(portstr, sizeof(portstr), "%d", port);
> > +            break;
> > +    }
> > +
> >      if (s->listen)
> >          hints.ai_flags |= AI_PASSIVE;
> >      if (!hostname[0])
> > @@ -268,3 +280,4 @@ const URLProtocol ff_tcp_protocol = {
> >      .flags               = URL_PROTOCOL_FLAG_NETWORK,
> >      .priv_data_class     = &tcp_class,
> >  };
> > +
> >
> delete this line.
>
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> ffmpeg-devel Info Page<http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
> ffmpeg.org
> This list is about FFmpeg development discussions and patches; but not for
> bug-reports. Please read the Code-of-conduct. To see the collection of
> prior postings to ...
>
>
>
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list