From c2b0152ad3468ffe35ecd6eb63afdee30e5d15c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 26 Jul 2026 13:48:35 +0200 Subject: [PATCH] avformat/libcurl: keep the seekable user override across replies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was applied once after the probe, from the wrong thread, and any follow-up reply re-evaluating seekability discarded it. Signed-off-by: Kacper Michajłow --- libavformat/libcurl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavformat/libcurl.c b/libavformat/libcurl.c index c7d786cba4..3c6a1730fd 100644 --- a/libavformat/libcurl.c +++ b/libavformat/libcurl.c @@ -354,6 +354,10 @@ static size_t header_callback(char *ptr, size_t size, size_t nitems, void *userd else c->request_end = c->content_size > 0 ? c->content_size - 1 : -1; } + /* Apply the user override on every reply so re-evaluation of a + * follow-up reply doesn't clobber it. */ + if (c->seekable_opt >= 0) + c->seekable = c->seekable_opt; } else { c->stream_ok = 0; if (!c->error) @@ -1029,11 +1033,9 @@ static int libcurl_open(URLContext *h, const char *url, int flags, if (ret < 0) goto fail; - if (c->seekable_opt == 0) - c->seekable = 0; - else if (c->seekable_opt == 1) - c->seekable = 1; + pthread_mutex_lock(&c->mutex); h->is_streamed = !c->seekable; + pthread_mutex_unlock(&c->mutex); return 0;