[FFmpeg-devel] [PATCH] always enable reuse for reading multicast udp

Martin Storsjö martin
Thu Oct 7 11:46:08 CEST 2010


On Thu, 7 Oct 2010, aviad rozenhek wrote:

> >
> > > @@ -361,6 +364,8 @@ static int udp_open(URLContext *h, const char *uri,
> > int flags)
> > >
> > >      if (s->is_multicast && !(h->flags & URL_WRONLY))
> > >          s->local_port = port;
> > > +    if(s->is_multicast && !has_reuse_arg && !(h->flags & (URL_WRONLY |
> > URL_RDWR)))
> > > +        s->reuse_socket = 1;
> >
> > Couldn't you do just && h->flags & URL_RDONLY at the end?
> >
> >
> no because URL_RDONLY is #defined to be 0

Ah, good point.

> > >      udp_fd = udp_socket_create(s, &my_addr, &len);
> > >      if (udp_fd < 0)
> > >          goto fail;
> > > --
> > > 1.6.0.4
> > >
> >
> > I don't think this would do much harm if enabled for all read-only
> > sockets, not only multicast. Then the code could be quite much simplified,
> > into something like this:
> >
> 
> I disagree since usually the expectation is that if a socket has been opened
> by one application, it cannot be opened by another application in parallel,
> except for the case of multicast.

Hmm, I'm not sure I agree here. Since UDP sockets generally are 
connectionless, another application receiving the same packets shouldn't 
be a problem.

But if we only want this enabled for multicast, I guess your patch is 
acceptable. Do others have an opinion here?

// Martin



More information about the ffmpeg-devel mailing list