summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Rosendahl <ext-sami.1.rosendahl@nokia.com>2012-03-26 14:05:27 +0300
committerQt by Nokia <qt-info@nokia.com>2012-03-27 06:28:31 +0200
commit13025c05c7471127873a3dc9928579387d1361ca (patch)
tree493fb678da64767a7247ecaf644c9271edfeaaa4
parentaa291c55b4dd2d647723fa32e9062a4d150d92ef (diff)
Deliver GStreamer signals through Qt event loopqt-v5.0.0-alpha1
Emitting a Qt signal directly from GLib callback causes issues to clients. Queue the GStreamer signal and forward it to as a Qt signal from a handler that is invoked via the Qt event loop. Task-number: QTBUG-24927 Change-Id: I3c91efcce1261caf7b643fbff10663e1b093f2a8 Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
-rw-r--r--src/gsttools/qgstreamerbushelper.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/gsttools/qgstreamerbushelper.cpp b/src/gsttools/qgstreamerbushelper.cpp
index 68c8795c..751e805b 100644
--- a/src/gsttools/qgstreamerbushelper.cpp
+++ b/src/gsttools/qgstreamerbushelper.cpp
@@ -98,17 +98,20 @@ private:
void processMessage(GstMessage* message)
{
QGstreamerMessage msg(message);
- foreach (QGstreamerBusMessageFilter *filter, busFilters) {
- if (filter->processBusMessage(msg))
- break;
- }
- emit m_helper->message(msg);
+ doProcessMessage(msg);
+ }
+
+ void queueMessage(GstMessage* message)
+ {
+ QGstreamerMessage msg(message);
+ QMetaObject::invokeMethod(this, "doProcessMessage", Qt::QueuedConnection,
+ Q_ARG(QGstreamerMessage, msg));
}
static gboolean busCallback(GstBus *bus, GstMessage *message, gpointer data)
{
Q_UNUSED(bus);
- reinterpret_cast<QGstreamerBusHelperPrivate*>(data)->processMessage(message);
+ reinterpret_cast<QGstreamerBusHelperPrivate*>(data)->queueMessage(message);
return TRUE;
}
@@ -117,6 +120,16 @@ private:
QGstreamerBusHelper* m_helper;
QTimer* m_intervalTimer;
+private slots:
+ void doProcessMessage(const QGstreamerMessage& msg)
+ {
+ foreach (QGstreamerBusMessageFilter *filter, busFilters) {
+ if (filter->processBusMessage(msg))
+ break;
+ }
+ emit m_helper->message(msg);
+ }
+
public:
QMutex filterMutex;
QList<QGstreamerSyncMessageFilter*> syncFilters;