Skip to content

Commit c181b08

Browse files
committed
http add reconnect_first_delay opt
1 parent 09868f6 commit c181b08

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

patches/ffmpeg-n6.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From 43d61d6f8a698efa92d5cf586db38cc380c48efc Mon Sep 17 00:00:00 2001
1+
From afb9fa8e856b5f1fa0d1e5d67192567167507aeb Mon Sep 17 00:00:00 2001
22
From: qianlongxu <[email protected]>
3-
Date: Thu, 7 Nov 2024 18:39:45 +0800
3+
Date: Tue, 12 Nov 2024 14:40:18 +0800
44
Subject: [PATCH 23] fix http open and http_seek (redirect) authentication bug
55

66
---
77
libavformat/http.c | 25 +++++++++++++++++++++++--
88
1 file changed, 23 insertions(+), 2 deletions(-)
99

1010
diff --git a/libavformat/http.c b/libavformat/http.c
11-
index 06f1bdd..4280614 100644
11+
index 06f1bdd..7c60a66 100644
1212
--- a/libavformat/http.c
1313
+++ b/libavformat/http.c
1414
@@ -78,6 +78,7 @@ typedef struct HTTPContext {
@@ -58,7 +58,7 @@ index 06f1bdd..4280614 100644
5858
+ if (err != 0 && cur_auth_type != s->auth_state.auth_type && s->http_code == 401) {
5959
+ //reverte the off,otherwise can't seek the target position.
6060
+ s->off = off;
61-
+ av_log(NULL, AV_LOG_ERROR, "http 401 error,need authenticate,s->off:%llu\n", s->buffer, s->off);
61+
+ av_log(NULL, AV_LOG_ERROR, "http 401 error,need authenticate:%s,at:%llu\n", s->buffer, s->off);
6262
+ err = 0;
6363
+ }
6464
done:
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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

Comments
 (0)