[FFmpeg-devel] [PATCH] Make RTP work with IPv6 enabled v.2

Michael Niedermayer michaelni
Sun Oct 28 20:23:32 CET 2007


Hi

On Sun, Oct 28, 2007 at 02:40:56PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On 10/28/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> >  On Sun, Oct 28, 2007 at 10:39:00AM -0400, Ronald S. Bultje wrote:
> > > Hi,
> > >
> > > On 10/28/07, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> > > >
> > > > If I split the sendto() into a separate connect() in udp_open() followed
> > > > by send() in udp_write(), the whole thing works as expected, but I guess
> > > > that won't go together with apps calling udp_set_remote_url() manually...
> > > > Best way may be to re-arrange  udp.c a bit to first set up the local part
> > > > in udp_open() and then call connect() in set_remote_url() and send() /
> > > > recv() instead of sendto() / recvfrom() in udp_read/write(), or is that a
> > > > bad idea?
> > >
> > >
> > > Since I'm not getting any replies, here's a new thread with all the patches
> > > needed to make it work on a Mac, I hope this catches attention and gets the
> > > patches in. Please consider committing all of these such that ffserver and
> > > udp in general works and is worth its LOC again.
> > >
> > > 1 - ffmpeg-bind.patch (from Nicolas), required such that we bind even if no
> > > port number was supplied, in which case the we let the OS choose one for us.
> > > Without the patch, such cases will not result in a bind in the ipv6-case,
> > > which makes that case fail. With the patch, that works correctly.
> 
> [..]
> 
> >  > Index: ffmpeg/libavformat/udp.c
> > > ===================================================================
> > > --- ffmpeg.orig/libavformat/udp.c     2007-10-14 21:49:42.000000000 -0400
> > > +++ ffmpeg/libavformat/udp.c  2007-10-14 22:02: 54.000000000 -0400
> > > @@ -111,7 +111,7 @@
> > >      struct addrinfo hints, *res = 0;
> > >      int error;
> > >      char sport[16];
> > > -    const char *node = 0, *service = 0;
> > > +    const char *node = 0, *service = "0";
> > >
> > >      if (port > 0) {
> > >          snprintf(sport, sizeof(sport), "%d", port);
> > > @@ -120,14 +120,12 @@
> > >      if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
> > >          node = hostname;
> > >      }
> > > -    if ((node) || (service)) {
> > > -        memset(&hints, 0, sizeof(hints));
> > > -        hints.ai_socktype = type;
> > > -        hints.ai_family   = family;
> > > -        hints.ai_flags = flags;
> > > -        if ((error = getaddrinfo(node, service, &hints, &res))) {
> > > -            av_log(NULL, AV_LOG_ERROR, "udp_ipv6_resolve_host: %s\n", gai_strerror(error));
> > > -        }
> > > +    memset(&hints, 0, sizeof(hints));
> > > +    hints.ai_socktype = type;
> > > +    hints.ai_family   = family;
> > > +    hints.ai_flags = flags;
> > > +    if ((error = getaddrinfo(node, service, &hints, &res))) {
> > > +     av_log(NULL, AV_LOG_ERROR, "udp_ipv6_resolve_host: %s\n", gai_strerror(error));
> >
> > tabs are forbidden in svn, also the reindentions do not belong in a
> > patch together with functional changes
> 
> Attached patch removes tabs and separates reindentation from
> functional changes. Since you're asking for better changelog messages,
> the one here would be:
> 
> ffmpeg-bind.patch: we should resolve hosts and bind sockets even when
> the local_port is not set (0), because in that case we want the OS to
> choose a free (ephemeral) port for us and we don't care what it is.
> Not binding the socket will result in the connection failing, choosing
> a free port will make it work as expected. This code is already
> correct in the parallel code path that exists if CONFIG_IPV6 is not
> defined, but the code is wrong if CONFIG_IPV6 is defined. This patch
> fixes that by removig the checks for local_port in the bind and
> port/host validity in host resolution. The result is that without this
> patch, rtsp/udp playback (ffplay) doesn't work if CONFIG_IPV6 is
> defined, but with this patch, it works as expected.
> 
> ffmpeg-bind-reindent.patch: reindentation after ffmpeg-bind.patch.
> 
> Patch courtesy of Nicolas George nicolas dot george at normalesup dot
> org, I'm just trying to get it in. :-).

i think the patches are ok but as i said i dunno the code


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071028/d0f2187d/attachment.pgp>



More information about the ffmpeg-devel mailing list