GstEnginePipeline: Run QTimer::singleShot in main thread

Partial fix for #1302
This commit is contained in:
Jonas Kvinge 2023-11-12 21:57:59 +01:00
parent c95886d8db
commit 6348649bc6
2 changed files with 7 additions and 2 deletions

View File

@ -110,6 +110,7 @@ void RegisterMetaTypes() {
#ifdef HAVE_GSTREAMER
qRegisterMetaType<GstBuffer*>("GstBuffer*");
qRegisterMetaType<GstElement*>("GstElement*");
qRegisterMetaType<GstState>("GstState");
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
#endif
qRegisterMetaType<CollectionDirectory>("CollectionDirectory");

View File

@ -1552,7 +1552,9 @@ QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(const GstState state)
void GstEnginePipeline::SetStateDelayed(const GstState state) {
QTimer::singleShot(300, this, [this, state]() { SetState(state); });
QMetaObject::invokeMethod(this, [this, state]() {
QTimer::singleShot(300, this, [this, state]() { SetState(state); });
}, Qt::QueuedConnection);
}
@ -1591,7 +1593,9 @@ void GstEnginePipeline::SeekQueued(const qint64 nanosec) {
void GstEnginePipeline::SeekDelayed(const qint64 nanosec) {
QTimer::singleShot(100, this, [this, nanosec]() { SeekQueued(nanosec); });
QMetaObject::invokeMethod(this, [this, nanosec]() {
QTimer::singleShot(100, this, [this, nanosec]() { Seek(nanosec); });
}, Qt::QueuedConnection);
}