Skip to content

Commit 22abcd5

Browse files
committed
[demux] Fix audio deadlock on quality STREAMCHANGE
When a bandwidth fluctuation triggered a representation change, Kodi Core reopened all active streams sequentially. If the first stream (Video) evaluated to no quality change, the m_checkCoreReopen optimization flag short-circuited all further OpenStream callbacks. If a subsequent stream (Audio) did change quality, its Reset() and reconstruction was skipped entirely, leaving it stuck at EVENT_TYPE::REP_CHANGE and permanently blocking segment downloads. This commit hoists a !isStreamChanged conditional to guard the entire m_checkCoreReopen block, guaranteeing that a formally changed stream bypasses the fast-path optimization and executes its native Reset() cycle.
1 parent 89de9df commit 22abcd5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ bool CInputStreamAdaptive::OpenStream(int streamid)
184184
if (!stream)
185185
return false;
186186

187+
const bool isStreamChanged{stream->m_adStream.StreamChanged()};
188+
187189
if (stream->IsEnabled())
188190
{
189191
// Stream quality changed (by "adaptive" streaming, not OSD)
190-
if (stream->m_adStream.StreamChanged())
192+
if (isStreamChanged)
191193
{
192194
stream->Reset();
193195
stream->m_adStream.Reset();
@@ -221,7 +223,7 @@ bool CInputStreamAdaptive::OpenStream(int streamid)
221223
}
222224
}
223225

224-
if (m_checkCoreReopen)
226+
if (m_checkCoreReopen && !isStreamChanged)
225227
{
226228
LOG::Log(LOGDEBUG, "OpenStream(%d): The stream has already been opened", streamid);
227229
return false;

0 commit comments

Comments
 (0)