From 5ff705a12477ffc6969b0d894c045990d764082a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 25 Apr 2024 13:58:32 +0300 Subject: [PATCH] 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. --- src/plugins/screencast/screencaststream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index 12d5bcc2a9..44fc7d71f8 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -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;