PR #25256 opened by Forgejo_Fairy
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25256
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25256.patch

An I/O error can close the persistent input while `input_read_done` remains 
set. The assertion in `read_data_continuous()` assumes the connection still 
exists, although `reload_playlist()` already handles a missing input.

Remove the invalid assertion and document why the input may be closed. This 
restores the behavior at this point before b5bf0a1a87c4 without changing 
playlist reloads or seek timestamp handling.

Related to #23798. This addresses the invalid assertion identified by source 
inspection; the reporter's Windows/Flyleaf interrupt-and-seek workflow has not 
been reproduced, and recovery in that application still needs confirmation.

Validation on Linux arm64, GCC 13, based on master 5a54fcf75e02:

- Built `ffmpeg`, `ffprobe` and `libavformat/tests/seek` with native HTTP 
support.
- `make fate-seek-hls SAMPLES=/opt/fate-suite` passed.
- Served the generated `tests/data/hls-seek.m3u8` fixture using Python's 
`ThreadingHTTPServer` and `SimpleHTTPRequestHandler` with `protocol_version = 
'HTTP/1.1'`. Ran `libavformat/tests/seek` against its loopback URL with 
`-duration 6` and `(http_persistent, http_multiple)` set to `(0,0)`, `(1,0)` 
and `(1,1)`. Every run exited successfully and its stdout matched 
`tests/ref/seek/hls` byte for byte.
- `git diff --check` passed.

These are ordinary playback/seek checks, not a runtime regression test for 
interrupted I/O. Source inspection also confirmed that the assertion is absent 
from the current release/9.0, release/8.1, release/8.0, release/7.1, 
release/6.1, release/5.1 and release/4.4 branches.


>From 00ac590f1908da0c9d16262bf3450178c0b1e5b9 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 30 Sep 2026 18:13:49 +0000
Subject: [PATCH] avformat/hls: allow a closed input when reloading after an
 I/O error

An I/O error can close the persistent input while input_read_done is
still set. The reload path already handles a missing input, so asserting
that it exists prevents otherwise valid error recovery.

Remove the assertion and document why the input may be closed. This
restores the pre-b5bf0a1a87c4 behavior at this point without changing
playlist reloads or seek timestamp handling.

Related: #23798
Assisted-by: Fairy
---
 libavformat/hls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 38d2a99fb2c..de0ce453b8d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1768,7 +1768,7 @@ static int read_data_continuous(void *opaque, uint8_t 
*buf, int buf_size)
     struct segment *seg;
 
     if (c->http_persistent && v->input_read_done) {
-        av_assert0(v->input);
+        /* A previous I/O error may have closed the input. */
         ret = reload_playlist(v, c);
         if (ret < 0)
             return ret;
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to