mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-14 05:12:27 +00:00
Force V-Sync enabled for DXVA2 windowed with DWM composition enabled
This commit is contained in:
parent
203b2fcaca
commit
9aa487418f
2 changed files with 7 additions and 1 deletions
|
@ -17,6 +17,7 @@ DEFINE_GUID(DXVADDI_Intel_ModeH264_E, 0x604F8E68,0x4951,0x4C54,0x88,0xFE,0xAB,0x
|
||||||
#define SAFE_COM_RELEASE(x) if (x) { (x)->Release(); }
|
#define SAFE_COM_RELEASE(x) if (x) { (x)->Release(); }
|
||||||
|
|
||||||
DXVA2Renderer::DXVA2Renderer() :
|
DXVA2Renderer::DXVA2Renderer() :
|
||||||
|
m_ForceVsyncOn(false),
|
||||||
m_DecService(nullptr),
|
m_DecService(nullptr),
|
||||||
m_Decoder(nullptr),
|
m_Decoder(nullptr),
|
||||||
m_SurfacesUsed(0),
|
m_SurfacesUsed(0),
|
||||||
|
@ -494,6 +495,10 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
|
||||||
d3dpp.SwapEffect = D3DSWAPEFFECT_FLIPEX;
|
d3dpp.SwapEffect = D3DSWAPEFFECT_FLIPEX;
|
||||||
d3dpp.BackBufferCount = 2;
|
d3dpp.BackBufferCount = 2;
|
||||||
|
|
||||||
|
// We need our V-sync source enabled to synchronize with DWM composition
|
||||||
|
// and avoid micro-stuttering.
|
||||||
|
m_ForceVsyncOn = true;
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Windowed mode with DWM running");
|
"Windowed mode with DWM running");
|
||||||
}
|
}
|
||||||
|
@ -626,7 +631,7 @@ int DXVA2Renderer::getDecoderCapabilities()
|
||||||
|
|
||||||
IFFmpegRenderer::VSyncConstraint DXVA2Renderer::getVsyncConstraint()
|
IFFmpegRenderer::VSyncConstraint DXVA2Renderer::getVsyncConstraint()
|
||||||
{
|
{
|
||||||
return VSYNC_ANY;
|
return m_ForceVsyncOn ? VSYNC_FORCE_ON : VSYNC_ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXVA2Renderer::renderFrameAtVsync(AVFrame *frame)
|
void DXVA2Renderer::renderFrameAtVsync(AVFrame *frame)
|
||||||
|
|
|
@ -45,6 +45,7 @@ private:
|
||||||
int m_VideoFormat;
|
int m_VideoFormat;
|
||||||
int m_VideoWidth;
|
int m_VideoWidth;
|
||||||
int m_VideoHeight;
|
int m_VideoHeight;
|
||||||
|
bool m_ForceVsyncOn;
|
||||||
|
|
||||||
int m_DisplayWidth;
|
int m_DisplayWidth;
|
||||||
int m_DisplayHeight;
|
int m_DisplayHeight;
|
||||||
|
|
Loading…
Reference in a new issue