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

Michael Niedermayer michaelni
Mon Oct 15 20:14:39 CEST 2007


Hi

On Sun, Oct 14, 2007 at 08:00:39PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On 10/14/07, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> >
> >
> > On 10/12/07, Nicolas George <nicolas.george at normalesup.org> wrote:
> > >
> > > Without IPv6, opening an UDP socket without an explicit local_port will
> > > call
> > > bind and getsockname to let the kernel choose an ephemeral port. If IPv6
> > > is
> > > enabled, it is not done.
> >
> >
> > This patch does only fix this issue for video-only or audio-only rtsp
> > streams, does it? In case of both video + audio, I get both trying to
> > connect to local port X (5000 in my case), second fails and I get the bind:
> > Address already in use error. (Not sure, really, trying to figure out what's
> > going on...)
> >
> 
> Actually, that's something else, rtsp opens rtp://?localport=%d and
> rtpproto.c doesn't strip the ? part since my url_split() refactor, I missed
> that somehow... This leads to it opening rtp://?localport=x?localport=x+1.
> Attached patch fixes that.
> 
> Ronald

> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c	(revision 10736)
> +++ libavformat/utils.c	(working copy)
> @@ -2875,7 +2875,7 @@
>                 char *path, int path_size,
>                 const char *url)
>  {
> -    const char *p, *ls, *at, *col, *brk;
> +    const char *p, *ls, *at, *col, *brk, *q;
>  
>      if (port_ptr)               *port_ptr = -1;
>      if (proto_size > 0)         proto[0] = 0;
> @@ -2896,9 +2896,12 @@
>      }
>  
>      /* separate path from hostname */
> -    if ((ls = strchr(p, '/')))
> -        av_strlcpy(path, ls, path_size);
> -    else
> +    if ((ls = strchr(p, '/'))) {
> +        if ((q = strchr(ls, '?')))
> +            av_strlcpy(path, ls, FFMIN(path_size, q - ls + 1));
> +        else
> +            av_strlcpy(path, ls, path_size);
> +    } else if (!(ls = strchr(p, '?')))
>          ls = &p[strlen(p)]; // XXX


the
-    else
+    else if (!(ls = strchr(p, '?')))
is ok

for the rest i would like to hear why exactly that is needed, it would
cut the part after the ? off and not return it at all which seems odd to
me, did our old url_split() behave like that?

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

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- 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/20071015/788406e3/attachment.pgp>



More information about the ffmpeg-devel mailing list