Skip to content

Commit

Permalink
GstEnginePipeline: Run QTimer::singleShot in main thread
Browse files Browse the repository at this point in the history
Partial fix for #1302
  • Loading branch information
jonaski committed Nov 12, 2023
1 parent c95886d commit 6348649
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/metatypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 6 additions & 2 deletions src/engine/gstenginepipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down Expand Up @@ -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);

}

Expand Down

0 comments on commit 6348649

Please sign in to comment.