I just try to use avio to read stream by http protocol.
But if the server responds too late, avio_read will return timeout, and
the only way I can do is close it and reopen.
Of course I can set a large timeout, but it's hard to decide which
timeout value is large enough.
On 2022/1/14 11:21, "zhilizhao(赵志立)" wrote:
On Jan 14, 2022, at 10:42 AM, Wang Chuan <ouchu...@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 <ouchu...@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@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".