From 91f27c444760d8aff0d15fffea44be321fba02b2 Mon Sep 17 00:00:00 2001 From: kontell Date: Mon, 27 Apr 2026 13:03:33 +0100 Subject: [PATCH] Fix 10-20s close delay on timeshift HLS streams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TimeshiftStream::Close() set m_running = false and immediately joined the input thread, but never aborted the in-flight av_read_frame() call. The reader thread would block until the current HTTP I/O completed or the 20-second av_read_frame timeout expired — meaning closing playback on a healthy HLS live source consistently hung for the full timeout window before the addon finished closing. DemuxAbort() expires the timeout, which makes the FFmpeg interrupt callback return 1 and av_read_frame return AVERROR_EXIT immediately. Calling it before join() makes Close() near-instant. Co-Authored-By: Claude Opus 4.6 --- src/stream/TimeshiftStream.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stream/TimeshiftStream.cpp b/src/stream/TimeshiftStream.cpp index eb0ddc03..bdcdabdc 100644 --- a/src/stream/TimeshiftStream.cpp +++ b/src/stream/TimeshiftStream.cpp @@ -78,6 +78,7 @@ bool TimeshiftStream::Start() void TimeshiftStream::Close() { m_running = false; + DemuxAbort(); if (m_inputThread.joinable()) m_inputThread.join();