avformat/hls: disable http_persistent/http_multiple with custom io_open

Both rely on the AVIOContext being backed by the builtin URLContext.
When the API user overrides io_open, the keepalive path asserts on the
missing URLContext and the http_multiple auto-detect probe fails on
every read. http_multiple=1 still works even with custom IO.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
Kacper Michajłow
2026-05-08 00:59:51 +02:00
parent fd25b35dd2
commit 17bc88e67f
+16
View File
@@ -2157,6 +2157,22 @@ static int hls_read_header(AVFormatContext *s)
if ((ret = ffio_copy_url_options(s->pb, &c->avio_opts)) < 0)
return ret;
/* http_persistent and http_multiple auto-detection both rely on the
* AVIOContext being backed by the builtin URLContext. Neither works
* when io_open is overridden with a custom callback. */
if (!ffio_geturlcontext(s->pb)) {
if (c->http_persistent) {
av_log(s, AV_LOG_WARNING, "Disabling http_persistent due to custom io_open.\n");
c->http_persistent = 0;
}
/* Only auto-detection is disabled, enabling http_multiple can still work
* with custom io_open. */
if (c->http_multiple == -1) {
av_log(s, AV_LOG_WARNING, "Disabling http_multiple due to custom io_open.\n");
c->http_multiple = 0;
}
}
/* XXX: Some HLS servers don't like being sent the range header,
in this case, we need to set http_seekable = 0 to disable
the range header */