Skip to content

Commit 35afbd0

Browse files
committed
stream_curl: extend version checks that enable curl by default
...to include older ffmpeg patch relases where the nested IO cleanup bug is fixed
1 parent 2d5dfb3 commit 35afbd0

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

DOCS/man/options.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5751,10 +5751,9 @@ TLS/connection diagnostics), set ``--msg-level=curl=trace``.
57515751
``--curl-enabled=<yes|no>``
57525752
Enable the libcurl-based network backend (default: ``yes``).
57535753

5754-
Defaults to ``no`` with libavformat < 62.15.101, which has a nested IO
5754+
Defaults to ``no`` on known older FFmpeg versions, which have a nested IO
57555755
cleanup bug that can cause crashes or memory leaks. The issue happens only
5756-
on transfer failures or aborts, can be enabled if you don't mind possible
5757-
stability issues.
5756+
on transfer failures or aborts.
57585757

57595758
``--curl-http-version=<auto|1.0|1.1|2|2tls|2-prior-knowledge|3|3only>``
57605759
Select the maximum HTTP protocol version libcurl is allowed to negotiate.

stream/stream_curl.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ struct curl_opts {
9292
#define CURL_HTTP_VERSION_3ONLY CURL_HTTP_VERSION_NONE
9393
#endif
9494

95+
// Older lavf has a bug with nested IO cleanup, so don't enable curl by default.
96+
// <https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23082>
97+
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(62, 15, 101)
98+
#define CURL_BY_DEFAULT
99+
#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(62, 12, 102) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(62, 13, 0)
100+
#define CURL_BY_DEFAULT /* 8.1 backport */
101+
#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(62, 3, 103) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(62, 4, 0)
102+
#define CURL_BY_DEFAULT /* 8.0 backport */
103+
#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(61, 7, 103) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(61, 8, 0)
104+
#define CURL_BY_DEFAULT /* 7.1 backport */
105+
#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(61, 1, 103) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(61, 2, 0)
106+
#define CURL_BY_DEFAULT /* 7.0 backport */
107+
#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(60, 16, 101) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(60, 17, 0)
108+
#define CURL_BY_DEFAULT /* 6.1 backport */
109+
#endif
110+
95111
#define OPT_BASE_STRUCT struct curl_opts
96112
const struct m_sub_options curl_conf = {
97113
.opts = (const struct m_option[]) {
@@ -116,9 +132,9 @@ const struct m_sub_options curl_conf = {
116132
{0}
117133
},
118134
.defaults = &(const struct curl_opts) {
119-
// Older lavf has a bug with nested IO cleanup, disable by default.
120-
// <https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23082>
121-
.enabled = LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(62, 15, 101),
135+
#ifdef CURL_BY_DEFAULT
136+
.enabled = true,
137+
#endif
122138
.http_version = CURL_HTTP_VERSION_NONE,
123139
.max_redirects = 16,
124140
.max_retries = 5,

0 commit comments

Comments
 (0)