mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-03-05 07:07:18 +00:00
Avoid consuming stale data during/after decoder reset
This commit is contained in:
parent
d6cfbdb273
commit
dfe275ab67
1 changed files with 11 additions and 0 deletions
|
@ -1045,6 +1045,9 @@ void FFmpegVideoDecoder::decoderThreadProc()
|
|||
SDL_Event event;
|
||||
event.type = SDL_RENDER_DEVICE_RESET;
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
// Don't consume any additional data
|
||||
SDL_AtomicSet(&m_DecoderThreadShouldQuit, 1);
|
||||
}
|
||||
}
|
||||
} while (err == AVERROR(EAGAIN) && !SDL_AtomicGet(&m_DecoderThreadShouldQuit));
|
||||
|
@ -1064,6 +1067,11 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
|||
|
||||
SDL_assert(!m_TestOnly);
|
||||
|
||||
// If this is the first frame, reject anything that's not an IDR frame
|
||||
if (m_FramesIn == 0 && du->frameType != FRAME_TYPE_IDR) {
|
||||
return DR_NEED_IDR;
|
||||
}
|
||||
|
||||
// Bail immediately if we need an IDR frame to continue
|
||||
if (Session::get()->getAndClearPendingIdrFrameStatus()) {
|
||||
return DR_NEED_IDR;
|
||||
|
@ -1148,6 +1156,9 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
|||
SDL_Event event;
|
||||
event.type = SDL_RENDER_DEVICE_RESET;
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
// Don't consume any additional data
|
||||
SDL_AtomicSet(&m_DecoderThreadShouldQuit, 1);
|
||||
}
|
||||
|
||||
return DR_NEED_IDR;
|
||||
|
|
Loading…
Add table
Reference in a new issue