[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: limit thread count by the ideal count in `ThreadRunner`
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Fri May 1 14:51:23 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
934fa2e6 by Fatih Uzunoglu at 2026-05-01T16:38:07+02:00
qt: limit thread count by the ideal count in `ThreadRunner`
If the cpu does not have 4 cores, this is not a good thing
because of context switch overhead.
- - - - -
58588820 by Fatih Uzunoglu at 2026-05-01T16:38:07+02:00
qt: set service level to eco in `ThreadRunner`
Since this class is supposed to be used for
media library tasks, we can set the service
level to eco in order to tell the operating
system to make use of energy efficient cores
for such tasks.
We still need to limit the thread count since
not all processors have energy efficient cores,
and in that case I assume that the operating
system would use all cores, which we don't
want in this case.
Currently Qt 6.10 docs state that this is only
implemented for Apple and Windows, since the
Qt we provide in the contribs is 6.8.3, this
will effectively not change anything until
we move to a newer Qt version, or Qt implements
it in other platforms where the contribs Qt
is usually not used (such as Linux).
- - - - -
1 changed file:
- modules/gui/qt/medialibrary/mlthreadpool.cpp
Changes:
=====================================
modules/gui/qt/medialibrary/mlthreadpool.cpp
=====================================
@@ -19,10 +19,21 @@
#include "mlthreadpool.hpp"
#include <QMutexLocker>
+#include <QThread>
+#include <QOperatingSystemVersion>
ThreadRunner::ThreadRunner()
{
- m_threadPool.setMaxThreadCount(4);
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
+ // This is currently only applicable on Windows (10 RS3) and Darwin, as of Qt 6.11:
+ m_threadPool.setServiceLevel(QThread::QualityOfService::Eco);
+#endif
+
+ // Even if we use energy efficient cores, we still need to limit the thread count,
+ // because not all processors have energy efficient cores and it is assumed that
+ // in that case all cores would be available:
+
+ m_threadPool.setMaxThreadCount(std::clamp(QThread::idealThreadCount() - 1, 1, 4));
}
ThreadRunner::~ThreadRunner()
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff6f387be0bbb6485ffe07e8a9c3cbeb8da6978e...5858882061a0d9f9bdbb65ae3dface44b07fc3fd
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff6f387be0bbb6485ffe07e8a9c3cbeb8da6978e...5858882061a0d9f9bdbb65ae3dface44b07fc3fd
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list