[vlc-commits] [Git][videolan/vlc][master] qt: assume the caller thread does not change in `VideoSurface::synchronize()`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jun 13 12:29:51 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1a5f5fdd by Fatih Uzunoglu at 2025-06-13T12:12:10+00:00
qt: assume the caller thread does not change in `VideoSurface::synchronize()`
We can have this assumption to not check for the thread each time it is
called. This can be expensive, as the method is called at v-sync rate.
We can do this because `VideoSurfaceProvider::supportsThreadedSurfaceUpdates()`
is already probed once and assumed to be constant.
For safety, I have added assertions for the debug build to check if this
assumption does not hold.
- - - - -
1 changed file:
- modules/gui/qt/maininterface/videosurface.cpp
Changes:
=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -234,14 +234,17 @@ void VideoSurface::synchronize()
QSizeF size;
QPointF position;
- if (QThread::currentThread() == thread())
+ static const bool isObjectThread = QThread::currentThread() == thread();
+ if (isObjectThread)
{
+ assert(QThread::currentThread() == thread());
// Item's thread (GUI thread):
size = this->size();
position = this->mapToScene(QPointF(0,0));
}
else
{
+ assert(QThread::currentThread() != thread());
// Render thread:
size = renderSize();
position = renderPosition();
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1a5f5fddb835d6f3f74256f91049d6c3726d1f84
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1a5f5fddb835d6f3f74256f91049d6c3726d1f84
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list