[FFmpeg-devel] [PATCH] libavformat/network: Fixed wait timeout functionality to exit immediately when timeout is 0.

Hendrik Leppkes h.leppkes at gmail.com
Fri Feb 16 11:07:51 EET 2018


On Fri, Feb 16, 2018 at 7:54 AM,  <rpatagar at akamai.com> wrote:
> From: Ravindra <rpatagar at akamai.com>
>
> Signed-off-by: Ravindra <rpatagar at akamai.com>
> ---
>  libavformat/network.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/network.c b/libavformat/network.c
> index d5c82e9..542bd3e 100644
> --- a/libavformat/network.c
> +++ b/libavformat/network.c
> @@ -85,7 +85,9 @@ int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterrupt
>          ret = ff_network_wait_fd(fd, write);
>          if (ret != AVERROR(EAGAIN))
>              return ret;
> -        if (timeout > 0) {
> +        if (!timeout) {
> +            return AVERROR(ETIMEDOUT);
> +        } else if (timeout > 0) {
>              if (!wait_start)
>                  wait_start = av_gettime_relative();
>              else if (av_gettime_relative() - wait_start > timeout)

Isn't that what AVIO_FLAG_NONBLOCK is basically for? It avoids calling
the wait functions entirely.

- Hendrik


More information about the ffmpeg-devel mailing list