[FFmpeg-devel] [PATCH] UDP hangs with no input data

Benoit Fouet benoit.fouet
Thu Nov 13 10:53:06 CET 2008


Le jeudi 13 novembre 2008 ? 10:31 +0100, Jindrich Makovicka a ?crit :
> On Wed, Nov 12, 2008 at 21:33, Michael Niedermayer <michaelni at gmx.at> wrote:
> > [...]
> >> @@ -426,6 +427,11 @@
> >>           * avoid losing data on OSes that set this too low by default. */
> >>          tmp = UDP_MAX_PKT_SIZE;
> >>          setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp));
> >> +        tv.tv_sec = 0;
> >> +        tv.tv_usec = 100 * 1000;
> >> +        if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
> >
> > posix says "Note that not all implementations allow this option to be set."
> > i dont know how relevant this is ...
> >
> > [...]
> >
> >> @@ -448,6 +454,8 @@
> >>              if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
> >>                  ff_neterrno() != FF_NETERROR(EINTR))
> >>                  return AVERROR(EIO);
> >> +            if (url_interrupt_cb())
> >> +                return AVERROR(EINTR);
> >>          } else {
> >>              break;
> >>          }
> >
> > that looks ok
> 
> Here is an alternate version using select() to be on the safe side.
> 

why are you using a fd_max variable ?
if you have good reasons, it should be used everywhere, not randomly
IMHO

-- 
Benoit






More information about the ffmpeg-devel mailing list