plugins/screencast: Make frame throttling less strict

If the max framerate is 60Hz, currently, the frameInterval is going to
be 16.6ms. On the other hand, lastSentAgo is likely to be just 16ms. So
the frame throttling timer will be started just to wait less than a
millisecond.
This commit is contained in:
Vlad Zahorodnii 2024-04-25 13:58:32 +03:00
parent 24f4e268a9
commit 5ff705a124

View file

@ -437,7 +437,7 @@ void ScreenCastStream::recordFrame(const QRegion &_damagedRegion)
}
if (m_videoFormat.max_framerate.num != 0 && !m_lastSent.isNull()) {
auto frameInterval = (1000. * m_videoFormat.max_framerate.denom / m_videoFormat.max_framerate.num);
auto frameInterval = (1000 * m_videoFormat.max_framerate.denom / m_videoFormat.max_framerate.num);
auto lastSentAgo = m_lastSent.msecsTo(QDateTime::currentDateTimeUtc());
if (lastSentAgo < frameInterval) {
m_pendingDamages += damagedRegion;