mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Fix random crash on stream start with renderers that require test frames
This commit is contained in:
@@ -819,6 +819,11 @@ private:
|
|||||||
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
|
emit m_Session->sessionFinished(m_Session->m_PortTestResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The video decoder must already be destroyed, since it could
|
||||||
|
// try to interact with APIs that can only be called between
|
||||||
|
// LiStartConnection() and LiStopConnection().
|
||||||
|
SDL_assert(m_Session->m_VideoDecoder == nullptr);
|
||||||
|
|
||||||
// Finish cleanup of the connection state
|
// Finish cleanup of the connection state
|
||||||
LiStopConnection();
|
LiStopConnection();
|
||||||
|
|
||||||
@@ -1717,6 +1722,8 @@ DispatchDeferredCleanup:
|
|||||||
SDL_AtomicUnlock(&m_InputHandlerLock);
|
SDL_AtomicUnlock(&m_InputHandlerLock);
|
||||||
|
|
||||||
// Destroy the decoder, since this must be done on the main thread
|
// Destroy the decoder, since this must be done on the main thread
|
||||||
|
// NB: This must happen before LiStopConnection() for pull-based
|
||||||
|
// decoders.
|
||||||
SDL_AtomicLock(&m_DecoderLock);
|
SDL_AtomicLock(&m_DecoderLock);
|
||||||
delete m_VideoDecoder;
|
delete m_VideoDecoder;
|
||||||
m_VideoDecoder = nullptr;
|
m_VideoDecoder = nullptr;
|
||||||
|
|||||||
@@ -424,13 +424,15 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, PDECODER
|
|||||||
|
|
||||||
// Tell overlay manager to use this frontend renderer
|
// Tell overlay manager to use this frontend renderer
|
||||||
Session::get()->getOverlayManager().setOverlayRenderer(m_FrontendRenderer);
|
Session::get()->getOverlayManager().setOverlayRenderer(m_FrontendRenderer);
|
||||||
}
|
|
||||||
|
|
||||||
m_DecoderThread = SDL_CreateThread(FFmpegVideoDecoder::decoderThreadProcThunk, "FFDecoder", (void*)this);
|
// Only create the decoder thread when instantiating the decoder for real. It will use APIs from
|
||||||
if (m_DecoderThread == nullptr) {
|
// moonlight-common-c that can only be legally called with an established connection.
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
m_DecoderThread = SDL_CreateThread(FFmpegVideoDecoder::decoderThreadProcThunk, "FFDecoder", (void*)this);
|
||||||
"Failed to create decoder thread: %s", SDL_GetError());
|
if (m_DecoderThread == nullptr) {
|
||||||
return false;
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Failed to create decoder thread: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user