mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Clear the decode queue on mouse lock or focus gain. This closes #5
This commit is contained in:
parent
3ce2d68250
commit
5d25874131
@ -27,6 +27,11 @@ static int ConvertPPButtonToLiButton(PP_InputEvent_MouseButton ppButton) {
|
|||||||
|
|
||||||
void MoonlightInstance::DidLockMouse(int32_t result) {
|
void MoonlightInstance::DidLockMouse(int32_t result) {
|
||||||
m_MouseLocked = (result == PP_OK);
|
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() {
|
void MoonlightInstance::MouseLockLost() {
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c9d332089fbd0662afb1386fcb4ae10979dc4f67
|
Subproject commit a8d98284a784d7e1f17d87bda220ee41e51c6560
|
@ -39,6 +39,7 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
|
|||||||
pp::Instance(instance),
|
pp::Instance(instance),
|
||||||
pp::MouseLock(this),
|
pp::MouseLock(this),
|
||||||
m_IsPainting(false),
|
m_IsPainting(false),
|
||||||
|
m_RequestIdrFrame(false),
|
||||||
m_OpusDecoder(NULL),
|
m_OpusDecoder(NULL),
|
||||||
m_CallbackFactory(this),
|
m_CallbackFactory(this),
|
||||||
m_MouseLocked(false),
|
m_MouseLocked(false),
|
||||||
@ -69,6 +70,7 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
|
|||||||
|
|
||||||
void DidLockMouse(int32_t result);
|
void DidLockMouse(int32_t result);
|
||||||
void MouseLockLost();
|
void MouseLockLost();
|
||||||
|
void DidChangeFocus(bool got_focus);
|
||||||
|
|
||||||
void OnConnectionStopped(uint32_t unused);
|
void OnConnectionStopped(uint32_t unused);
|
||||||
void OnConnectionStarted(uint32_t error);
|
void OnConnectionStarted(uint32_t error);
|
||||||
@ -125,6 +127,7 @@ class MoonlightInstance : public pp::Instance, public pp::MouseLock {
|
|||||||
Shader m_ExternalOesShader;
|
Shader m_ExternalOesShader;
|
||||||
std::queue<PP_VideoPicture> m_PendingPictureQueue;
|
std::queue<PP_VideoPicture> m_PendingPictureQueue;
|
||||||
bool m_IsPainting;
|
bool m_IsPainting;
|
||||||
|
bool m_RequestIdrFrame;
|
||||||
|
|
||||||
OpusMSDecoder* m_OpusDecoder;
|
OpusMSDecoder* m_OpusDecoder;
|
||||||
pp::Audio m_AudioPlayer;
|
pp::Audio m_AudioPlayer;
|
||||||
|
14
viddec.cpp
14
viddec.cpp
@ -54,6 +54,14 @@ static const char k_FragmentShaderExternal[] =
|
|||||||
" gl_FragColor = texture2D(s_texture, v_texCoord); \n"
|
" 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::DidChangeView(const pp::Rect& position,
|
void MoonlightInstance::DidChangeView(const pp::Rect& position,
|
||||||
const pp::Rect& clip) {
|
const pp::Rect& clip) {
|
||||||
|
|
||||||
@ -169,6 +177,12 @@ int MoonlightInstance::VidDecSubmitDecodeUnit(PDECODE_UNIT decodeUnit) {
|
|||||||
PLENTRY entry;
|
PLENTRY entry;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
|
|
||||||
|
// Request an IDR frame if needed
|
||||||
|
if (g_Instance->m_RequestIdrFrame) {
|
||||||
|
g_Instance->m_RequestIdrFrame = false;
|
||||||
|
return DR_NEED_IDR;
|
||||||
|
}
|
||||||
|
|
||||||
// Resize the decode buffer if needed
|
// Resize the decode buffer if needed
|
||||||
if (decodeUnit->fullLength > s_DecodeBufferLength) {
|
if (decodeUnit->fullLength > s_DecodeBufferLength) {
|
||||||
free(s_DecodeBuffer);
|
free(s_DecodeBuffer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user