|
| 1 | +From 18f90d0efc60ba8bee97bbe1c7c1a6f139b9ff24 Mon Sep 17 00:00:00 2001 |
| 2 | +From: qianlongxu < [email protected]> |
| 3 | +Date: Tue, 12 Nov 2024 14:42:37 +0800 |
| 4 | +Subject: [PATCH 26] http add reconnect_first_delay opt |
| 5 | + |
| 6 | +--- |
| 7 | + libavformat/http.c | 4 +++- |
| 8 | + 1 file changed, 3 insertions(+), 1 deletion(-) |
| 9 | + |
| 10 | +diff --git a/libavformat/http.c b/libavformat/http.c |
| 11 | +index 7c60a66..c8fad90 100644 |
| 12 | +--- a/libavformat/http.c |
| 13 | ++++ b/libavformat/http.c |
| 14 | +@@ -127,6 +127,7 @@ typedef struct HTTPContext { |
| 15 | + int reconnect_on_network_error; |
| 16 | + int reconnect_streamed; |
| 17 | + int reconnect_delay_max; |
| 18 | ++ int reconnect_first_delay; |
| 19 | + char *reconnect_on_http_error; |
| 20 | + int listen; |
| 21 | + char *resource; |
| 22 | +@@ -181,6 +182,7 @@ static const AVOption options[] = { |
| 23 | + { "reconnect_on_http_error", "list of http status codes to reconnect on", OFFSET(reconnect_on_http_error), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D }, |
| 24 | + { "reconnect_streamed", "auto reconnect streamed / non seekable streams", OFFSET(reconnect_streamed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, D }, |
| 25 | + { "reconnect_delay_max", "max reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_max), AV_OPT_TYPE_INT, { .i64 = 120 }, 0, UINT_MAX/1000/1000, D }, |
| 26 | ++ { "reconnect_first_delay", "first reconnect delay in seconds", OFFSET(reconnect_first_delay), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT_MAX/1000/1000, D }, |
| 27 | + { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, |
| 28 | + { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, |
| 29 | + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, |
| 30 | +@@ -371,7 +373,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) |
| 31 | + HTTPAuthType cur_auth_type, cur_proxy_auth_type; |
| 32 | + HTTPContext *s = h->priv_data; |
| 33 | + int ret, attempts = 0, redirects = 0; |
| 34 | +- int reconnect_delay = 0; |
| 35 | ++ int reconnect_delay = s->reconnect_first_delay; |
| 36 | + uint64_t off; |
| 37 | + char *cached; |
| 38 | + |
| 39 | +-- |
| 40 | +2.39.5 (Apple Git-154) |
| 41 | + |
0 commit comments