[FFmpeg-devel] [PATCH] avformat/aviobuf: let avio_read can retry when timeout

"zhilizhao(赵志立)" quinkblack at foxmail.com
Fri Jan 14 05:21:07 EET 2022



> On Jan 14, 2022, at 10:42 AM, Wang Chuan <ouchuanm at outlook.com> wrote:
> 
> If we meet timeout when reading network resource, avio_read will set
> [eof_reached] to 1. And this prevent caller to retry since avio_read
> do nothing and just return if eof_reached == 1.

If timeout was triggered by a small ‘timeout’ setting from user, just
change the ‘timeout' configuration. If it was triggered by a system call,
it’s likely to be in a state of not recoverable. Could you share more
details about the issue this patch trying to solve?

> 
> Signed-off-by: Wang Chuan <ouchuanm at outlook.com>
> ---
> libavformat/aviobuf.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 29d4bd7510..38cb21debf 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -580,8 +580,9 @@ static void fill_buffer(AVIOContext *s)
>            be done without rereading data */
>         s->eof_reached = 1;
>     } else if (len < 0) {
> -        s->eof_reached = 1;
> -        s->error= len;
> +        s->error = len;
> +        if (s->error != AVERROR(ETIMEDOUT))
> +            s->eof_reached = 1;
>     } else {
>         s->pos += len;
>         s->buf_ptr = dst;
> -- 
> 2.29.2
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list