mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 23:35:55 +00:00
Convert NeedsIdr member into an atomic variable with a getter
This commit is contained in:
parent
b9a6fb1fe5
commit
8a27fa7bb5
@ -264,14 +264,12 @@ int Session::drSubmitDecodeUnit(PDECODE_UNIT du)
|
|||||||
// safely return DR_OK and wait for m_NeedsIdr to be set by
|
// safely return DR_OK and wait for m_NeedsIdr to be set by
|
||||||
// the decoder reinitialization code.
|
// the decoder reinitialization code.
|
||||||
|
|
||||||
if (SDL_AtomicTryLock(&s_ActiveSession->m_DecoderLock)) {
|
if (s_ActiveSession->getAndClearPendingIdrFrameStatus()) {
|
||||||
if (s_ActiveSession->m_NeedsIdr) {
|
// If we reset our decoder, we'll need to request an IDR frame
|
||||||
// If we reset our decoder, we'll need to request an IDR frame
|
return DR_NEED_IDR;
|
||||||
s_ActiveSession->m_NeedsIdr = false;
|
}
|
||||||
SDL_AtomicUnlock(&s_ActiveSession->m_DecoderLock);
|
|
||||||
return DR_NEED_IDR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (SDL_AtomicTryLock(&s_ActiveSession->m_DecoderLock)) {
|
||||||
IVideoDecoder* decoder = s_ActiveSession->m_VideoDecoder;
|
IVideoDecoder* decoder = s_ActiveSession->m_VideoDecoder;
|
||||||
if (decoder != nullptr) {
|
if (decoder != nullptr) {
|
||||||
int ret = decoder->submitDecodeUnit(du);
|
int ret = decoder->submitDecodeUnit(du);
|
||||||
@ -379,7 +377,6 @@ Session::Session(NvComputer* computer, NvApp& app, StreamingPreferences *prefere
|
|||||||
m_Window(nullptr),
|
m_Window(nullptr),
|
||||||
m_VideoDecoder(nullptr),
|
m_VideoDecoder(nullptr),
|
||||||
m_DecoderLock(0),
|
m_DecoderLock(0),
|
||||||
m_NeedsIdr(false),
|
|
||||||
m_AudioDisabled(false),
|
m_AudioDisabled(false),
|
||||||
m_AudioMuted(false),
|
m_AudioMuted(false),
|
||||||
m_DisplayOriginX(0),
|
m_DisplayOriginX(0),
|
||||||
@ -397,6 +394,7 @@ Session::Session(NvComputer* computer, NvApp& app, StreamingPreferences *prefere
|
|||||||
m_AudioSampleCount(0),
|
m_AudioSampleCount(0),
|
||||||
m_DropAudioEndTime(0)
|
m_DropAudioEndTime(0)
|
||||||
{
|
{
|
||||||
|
SDL_AtomicSet(&m_NeedsIdr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: This may not get destroyed for a long time! Don't put any vital cleanup here.
|
// NB: This may not get destroyed for a long time! Don't put any vital cleanup here.
|
||||||
@ -1185,6 +1183,11 @@ void Session::flushWindowEvents()
|
|||||||
SDL_PushEvent(&flushEvent);
|
SDL_PushEvent(&flushEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Session::getAndClearPendingIdrFrameStatus()
|
||||||
|
{
|
||||||
|
return SDL_AtomicSet(&m_NeedsIdr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
class ExecThread : public QThread
|
class ExecThread : public QThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1634,7 +1637,7 @@ void Session::execInternal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Request an IDR frame to complete the reset
|
// Request an IDR frame to complete the reset
|
||||||
m_NeedsIdr = true;
|
SDL_AtomicSet(&m_NeedsIdr, 1);
|
||||||
|
|
||||||
SDL_AtomicUnlock(&m_DecoderLock);
|
SDL_AtomicUnlock(&m_DecoderLock);
|
||||||
break;
|
break;
|
||||||
|
@ -42,6 +42,8 @@ public:
|
|||||||
|
|
||||||
void flushWindowEvents();
|
void flushWindowEvents();
|
||||||
|
|
||||||
|
bool getAndClearPendingIdrFrameStatus();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stageStarting(QString stage);
|
void stageStarting(QString stage);
|
||||||
|
|
||||||
@ -145,7 +147,7 @@ private:
|
|||||||
SDL_Window* m_Window;
|
SDL_Window* m_Window;
|
||||||
IVideoDecoder* m_VideoDecoder;
|
IVideoDecoder* m_VideoDecoder;
|
||||||
SDL_SpinLock m_DecoderLock;
|
SDL_SpinLock m_DecoderLock;
|
||||||
bool m_NeedsIdr;
|
SDL_atomic_t m_NeedsIdr;
|
||||||
bool m_AudioDisabled;
|
bool m_AudioDisabled;
|
||||||
bool m_AudioMuted;
|
bool m_AudioMuted;
|
||||||
Uint32 m_FullScreenFlag;
|
Uint32 m_FullScreenFlag;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user