[PATCH] Adjust timers from the correct thread
authorDavid Edmundson <kde@davidedmundson.co.uk>
Thu, 26 Jun 2025 13:50:27 +0000 (14:50 +0100)
committerAurélien COUDERC <coucouf@debian.org>
Tue, 15 Jul 2025 14:45:40 +0000 (16:45 +0200)
PipeWireBaseEncodedStream moves the PipeWireProduce into another thread. It is
therefore it's responsiblity to ensure that any calls into PipeWireProduce are
run in the correct thread.

This addresses a warning about timers.

Gbp-Pq: Name upstream_9fe7a568_Adjust-timers-from-the-correct-thread.patch

src/pipewirebaseencodedstream.cpp

index de51a9038caee3e7e10d088e0be847e4a0795bd4..b17ee1bbf945aa52e118ea83d529e88fca71a84a 100644 (file)
@@ -103,9 +103,13 @@ void PipeWireBaseEncodedStream::setMaxFramerate(const Fraction &framerate)
     }
     d->m_maxFramerate = framerate;
 
-    if (d->m_produce) {
-        d->m_produce->setMaxFramerate(d->m_maxFramerate);
-    }
+    // produce runs in another thread
+    QMetaObject::invokeMethod(
+        d->m_produce.get(),
+        [produce = d->m_produce.get(), framerate]() {
+            produce->setMaxFramerate(framerate);
+        },
+        Qt::QueuedConnection);
 
     Q_EMIT maxFramerateChanged();
 }