Add the code back to request an IDR frame when switching back to Moonlight

This commit is contained in:
Cameron Gutman 2016-07-10 22:23:01 -07:00
parent c2fde815fa
commit 12e34a9f4e
3 changed files with 22 additions and 0 deletions

View File

@ -23,6 +23,11 @@ static int ConvertPPButtonToLiButton(PP_InputEvent_MouseButton ppButton) {
void MoonlightInstance::DidLockMouse(int32_t result) {
m_MouseLocked = (result == PP_OK);
if (m_MouseLocked) {
// Request an IDR frame to dump the frame queue that may have
// built up from the GL pipeline being stalled.
g_Instance->m_RequestIdrFrame = true;
}
}
void MoonlightInstance::MouseLockLost() {

View File

@ -53,6 +53,7 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
pp::MouseLock(this),
m_HasNextPicture(false),
m_IsPainting(false),
m_RequestIdrFrame(false),
m_OpusDecoder(NULL),
m_CallbackFactory(this),
m_MouseLocked(false),
@ -122,6 +123,7 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
void PictureReady(int32_t result, PP_VideoPicture picture);
void PaintPicture(void);
void InitializeRenderingSurface(int width, int height);
void DidChangeFocus(bool got_focus);
static void VidDecSetup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags);
static void VidDecCleanup(void);
@ -159,6 +161,7 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
bool m_HasNextPicture;
PP_VideoPicture m_CurrentPicture;
bool m_IsPainting;
bool m_RequestIdrFrame;
OpusMSDecoder* m_OpusDecoder;
pp::Audio m_AudioPlayer;

View File

@ -62,6 +62,14 @@ static const char k_FragmentShaderExternal[] =
" gl_FragColor = texture2D(s_texture, v_texCoord); \n"
"}";
void MoonlightInstance::DidChangeFocus(bool got_focus) {
// Request an IDR frame to dump the frame queue that may have
// built up from the GL pipeline being stalled.
if (got_focus) {
g_Instance->m_RequestIdrFrame = true;
}
}
void MoonlightInstance::InitializeRenderingSurface(int width, int height) {
if (!glInitializePPAPI(pp::Module::Get()->get_browser_interface())) {
return;
@ -230,6 +238,12 @@ int MoonlightInstance::VidDecSubmitDecodeUnit(PDECODE_UNIT decodeUnit) {
bool isSps = false;
bool isPps = false;
bool isIframe = false;
// Request an IDR frame if needed
if (g_Instance->m_RequestIdrFrame) {
g_Instance->m_RequestIdrFrame = false;
return DR_NEED_IDR;
}
// Look at the NALU type
if (decodeUnit->bufferList->length > 5) {