screencopy: clamp the timer to a miminum of 6 milliseconds (#226)

When the timer is less than 6 milliseconds, the screen copy portal would frequently fail to start working.
This commit is contained in:
Aqa-Ib 2024-06-11 22:57:19 +02:00 committed by GitHub
parent 72907822c1
commit 8f1ee9f964
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -689,7 +689,7 @@ void CScreencopyPortal::queueNextShareFrame(CScreencopyPortal::SSession* pSessio
Debug::log(TRACE, "[screencopy] set fps {}, frame took {:.2f}ms, ms till next refresh {:.2f}, estimated actual fps: {:.2f}", pSession->sharingData.framerate, FRAMETOOKMS,
MSTILNEXTREFRESH, std::clamp(1000.0 / FRAMETOOKMS, 1.0, (double)pSession->sharingData.framerate));
g_pPortalManager->addTimer({std::clamp(MSTILNEXTREFRESH - 1.0 /* safezone */, 1.0, 1000.0), [pSession]() { g_pPortalManager->m_sPortals.screencopy->startFrameCopy(pSession); }});
g_pPortalManager->addTimer({std::clamp(MSTILNEXTREFRESH - 1.0 /* safezone */, 6.0, 1000.0), [pSession]() { g_pPortalManager->m_sPortals.screencopy->startFrameCopy(pSession); }});
}
bool CScreencopyPortal::hasToplevelCapabilities() {
return m_sState.toplevel;