[FFmpeg-devel] [PATCH 3/3] Non-blocking protocols: TCP

Martin Storsjö martin
Sat Jan 29 21:16:22 CET 2011


On Sat, 29 Jan 2011, Nicolas George wrote:

> +    int ret;
> +
> +    if (!(h->flags & URL_FLAG_NONBLOCK)) {
> +        ret = tcp_wait_fd(s->fd, 0);
> +        if (ret < 0)
> +            return ret;
>      }
> +    ret = recv(s->fd, buf, size, 0);
> +    return ret < 0 ? ff_neterrno() : ret;
>  }

Uhm, for the blocking case, wouldn't you need to loop on waiting for the 
fd to become readable? Otherwise we'd return EAGAIN after 100 ms.

Also, in such a loop, you must check url_interrupt_cb(), in order to be 
able to abort the blocking wait externally.

// Martin



More information about the ffmpeg-devel mailing list