PR #26084 opened by Robert Kopaczewski (23doors) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26084 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26084.patch
When a request on the kept-alive connection fails, open_url_keepalive() closes it, but input_read_done stays set until the next segment is opened. If read_data_continuous() returns before that (the playlist ended, an init section could not be opened, the interrupt callback fired), the next read aborts on av_assert0(v->input). A VOD playlist whose last segment returns 404 is enough: the segment is retried, skipped, and ffmpeg aborts instead of ending the stream. The assert came with b5bf0a1a87; before it the stale flag was harmless. Clear input_read_done when there is no input, so the next segment is opened on a new connection. Found with the help of an AI assistant. Signed-off-by: Robert Kopaczewski <[email protected]> # Summary of changes Briefly describe what this PR does and why. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 7aada647b711f3f09a5afb6aabd409ff7108c218 Mon Sep 17 00:00:00 2001 From: 23doors <[email protected]> Date: Sun, 15 Nov 2026 21:55:17 +0000 Subject: [PATCH] avformat/hls: fix assertion failure after a failed keep-alive request When a request on the kept-alive connection fails, open_url_keepalive() closes it, but input_read_done stays set until the next segment is opened. If read_data_continuous() returns before that (the playlist ended, an init section could not be opened, the interrupt callback fired), the next read aborts on av_assert0(v->input). A VOD playlist whose last segment returns 404 is enough: the segment is retried, skipped, and ffmpeg aborts instead of ending the stream. The assert came with b5bf0a1a87; before it the stale flag was harmless. Clear input_read_done when there is no input, so the next segment is opened on a new connection. Found with the help of an AI assistant. Signed-off-by: Robert Kopaczewski <[email protected]> --- libavformat/hls.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 91bc7fa6508..d68c4c6749e 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1952,6 +1952,11 @@ static int read_data_continuous(void *opaque, uint8_t *buf, int buf_size) int segment_retries = 0; struct segment *seg; + /* The kept connection is gone after a failed request on it or after + * the init section was read through it; the flag must not outlive it. */ + if (!v->input) + v->input_read_done = 0; + if (c->http_persistent && v->input_read_done) { av_assert0(v->input); ret = reload_playlist(v, c); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
