From c37caa8070a8280cae2e4c73b8146aa490d14117 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 7 Sep 2016 15:17:24 +0200 Subject: Remove unnecessary import statement in QML snippet Change-Id: I1f34e52c4a8f72a91b1c673fe7e152335d8a0ade Reviewed-by: Venugopal Shivashankar --- src/imports/multimedia/qdeclarativeplaylist.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/imports/multimedia/qdeclarativeplaylist.cpp b/src/imports/multimedia/qdeclarativeplaylist.cpp index 19413dec8..fc31e762f 100644 --- a/src/imports/multimedia/qdeclarativeplaylist.cpp +++ b/src/imports/multimedia/qdeclarativeplaylist.cpp @@ -88,9 +88,6 @@ void QDeclarativePlaylistItem::setSource(const QUrl &source) item's source URL can be accessed using the \c source role. \qml - import QtQuick 2.0 - import QtMultimedia 5.6 - Item { width: 400; height: 300; -- cgit v1.2.3 From 07d55b154e19f3f4f8525b541c44500273be70ab Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 9 Sep 2016 11:49:54 +0200 Subject: Don't try to compile Vivante video node plugin without OpenGL ES Task-number: QTBUG-54315 Change-Id: I559f67e1f24cbed5155fd0e4330cd12150d4dbf9 Reviewed-by: Laszlo Agocs --- qtmultimedia.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qtmultimedia.pro b/qtmultimedia.pro index 98bb3152f..a49700d16 100644 --- a/qtmultimedia.pro +++ b/qtmultimedia.pro @@ -33,7 +33,7 @@ win32 { } qtCompileTest(resourcepolicy) - qtCompileTest(gpu_vivante) + contains(QT_CONFIG, opengles2):qtCompileTest(gpu_vivante) } load(qt_parts) -- cgit v1.2.3 From bf5c7ca718a4a84e28a17ff69c4b18abee81ff93 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 10 Aug 2016 12:53:13 +0200 Subject: Make tst_QMediaObject::notifySignals() less flaky Rather than expecting a certain amount of signals to be fired within a fixed period, check that all the required signals are emitted and that it doesn't take longer than expected. Use a margin of error to take into account timers firing later because of high system load. Change-Id: I1569ce524e87efc47eb8d11066e509e5dc90f6f8 (cherry picked from commit 586abbd9732f9ccce127429fe0698c25a09ecefb) Reviewed-by: Christian Stromme --- tests/auto/unit/qmediaobject/tst_qmediaobject.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp b/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp index 355af5676..e79d9b586 100644 --- a/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp +++ b/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp @@ -293,14 +293,19 @@ void tst_QMediaObject::notifySignals() QFETCH(int, count); QtTestMediaObject object; + QSignalSpy spy(&object, SIGNAL(aChanged(int))); + object.setNotifyInterval(interval); object.addPropertyWatch("a"); - QSignalSpy spy(&object, SIGNAL(aChanged(int))); + QElapsedTimer timer; + timer.start(); - QTestEventLoop::instance().enterLoop(1); + QTRY_COMPARE(spy.count(), count); - QCOMPARE(spy.count(), count); + qint64 elapsed = timer.elapsed(); + int expectedElapsed = count * interval * 1.3; // give it some margin of error + QVERIFY2(elapsed < expectedElapsed, QString("elapsed: %1, expected: %2").arg(elapsed).arg(expectedElapsed).toLocal8Bit().constData()); } void tst_QMediaObject::notifyInterval_data() -- cgit v1.2.3 From 4bae7697257e5294721211fdd0b9bad5731f70c9 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 20 Sep 2016 19:28:40 +0300 Subject: PulseAudio: make code more robust Some asynchronous operations return a pa_operation pointer, which can be null if the operation fails. In some cases we were not checking that the returned object was non null, leading to some asserts being raised in pa_operation_unref. Change-Id: Iff1cc67b7f79b758fa81d79e658debb1d737b29f Reviewed-by: Christian Stromme --- src/multimedia/audio/qsoundeffect_pulse_p.cpp | 61 +++++++++++++++++++------ src/plugins/pulseaudio/qpulseaudioengine.cpp | 65 ++++++++++++++++++++------- 2 files changed, 95 insertions(+), 31 deletions(-) diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index 1fb10d121..5bb5119a8 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -437,7 +437,11 @@ void QSoundEffectPrivate::setSource(const QUrl &url) if (m_pulseStream && !pa_stream_is_corked(m_pulseStream)) { pa_stream_set_write_callback(m_pulseStream, 0, 0); pa_stream_set_underflow_callback(m_pulseStream, 0, 0); - pa_operation_unref(pa_stream_cork(m_pulseStream, 1, 0, 0)); + pa_operation *op = pa_stream_cork(m_pulseStream, 1, 0, 0); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to cork stream"); } setPlaying(false); @@ -619,7 +623,11 @@ void QSoundEffectPrivate::emptyStream(EmptyStreamOptions options) m_emptying = true; pa_stream_set_write_callback(m_pulseStream, 0, 0); pa_stream_set_underflow_callback(m_pulseStream, 0, 0); - pa_operation_unref(pa_stream_flush(m_pulseStream, flushCompleteCb, m_ref->getRef())); + pa_operation *op = pa_stream_flush(m_pulseStream, flushCompleteCb, m_ref->getRef()); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to flush stream"); } void QSoundEffectPrivate::emptyComplete(void *stream, bool reload) @@ -631,8 +639,13 @@ void QSoundEffectPrivate::emptyComplete(void *stream, bool reload) m_emptying = false; - if ((pa_stream *)stream == m_pulseStream) - pa_operation_unref(pa_stream_cork(m_pulseStream, 1, reload ? stream_cork_callback : 0, m_ref->getRef())); + if ((pa_stream *)stream == m_pulseStream) { + pa_operation *op = pa_stream_cork(m_pulseStream, 1, reload ? stream_cork_callback : 0, m_ref->getRef()); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to cork stream"); + } } void QSoundEffectPrivate::sampleReady() @@ -666,7 +679,11 @@ void QSoundEffectPrivate::sampleReady() pa_buffer_attr newBufferAttr; newBufferAttr = *bufferAttr; newBufferAttr.prebuf = m_sample->data().size(); - pa_operation_unref(pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef())); + pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef()); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); } else { streamReady(); } @@ -679,12 +696,20 @@ void QSoundEffectPrivate::sampleReady() newBufferAttr.minreq = bufferAttr->tlength / 2; newBufferAttr.prebuf = -1; newBufferAttr.fragsize = -1; - pa_operation_unref(pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_reset_buffer_callback, m_ref->getRef())); + pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_reset_buffer_callback, m_ref->getRef()); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); } else if (bufferAttr->prebuf > uint32_t(m_sample->data().size())) { pa_buffer_attr newBufferAttr; newBufferAttr = *bufferAttr; newBufferAttr.prebuf = m_sample->data().size(); - pa_operation_unref(pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef())); + pa_operation *op = pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, m_ref->getRef()); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); } else { streamReady(); } @@ -989,7 +1014,11 @@ void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata) pa_buffer_attr newBufferAttr; newBufferAttr = *bufferAttr; newBufferAttr.prebuf = self->m_sample->data().size(); - pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, self->m_ref->getRef()); + pa_operation *op = pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, self->m_ref->getRef()); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); } else { QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection); } @@ -1026,7 +1055,7 @@ void QSoundEffectPrivate::stream_reset_buffer_callback(pa_stream *s, int success return; if (!success) - qWarning("QSoundEffect(pulseaudio): faild to reset buffer attribute"); + qWarning("QSoundEffect(pulseaudio): failed to reset buffer attribute"); #ifdef QT_PA_DEBUG qDebug() << self << "stream_reset_buffer_callback"; #endif @@ -1036,7 +1065,11 @@ void QSoundEffectPrivate::stream_reset_buffer_callback(pa_stream *s, int success pa_buffer_attr newBufferAttr; newBufferAttr = *bufferAttr; newBufferAttr.prebuf = self->m_sample->data().size(); - pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata); + pa_operation *op = pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata); + if (op) + pa_operation_unref(op); + else + qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); } else { QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection); } @@ -1055,7 +1088,7 @@ void QSoundEffectPrivate::stream_adjust_prebuffer_callback(pa_stream *s, int suc return; if (!success) - qWarning("QSoundEffect(pulseaudio): faild to adjust pre-buffer attribute"); + qWarning("QSoundEffect(pulseaudio): failed to adjust pre-buffer attribute"); #ifdef QT_PA_DEBUG qDebug() << self << "stream_adjust_prebuffer_callback"; #endif @@ -1090,7 +1123,7 @@ void QSoundEffectPrivate::stream_cork_callback(pa_stream *s, int success, void * return; if (!success) - qWarning("QSoundEffect(pulseaudio): faild to stop"); + qWarning("QSoundEffect(pulseaudio): failed to stop"); #ifdef QT_PA_DEBUG qDebug() << self << "stream_cork_callback"; #endif @@ -1110,7 +1143,7 @@ void QSoundEffectPrivate::stream_flush_callback(pa_stream *s, int success, void return; if (!success) - qWarning("QSoundEffect(pulseaudio): faild to drain"); + qWarning("QSoundEffect(pulseaudio): failed to drain"); QMetaObject::invokeMethod(self, "emptyComplete", Qt::QueuedConnection, Q_ARG(void*, s), Q_ARG(bool, false)); } @@ -1128,7 +1161,7 @@ void QSoundEffectPrivate::stream_flush_reload_callback(pa_stream *s, int success return; if (!success) - qWarning("QSoundEffect(pulseaudio): faild to drain"); + qWarning("QSoundEffect(pulseaudio): failed to drain"); QMetaObject::invokeMethod(self, "emptyComplete", Qt::QueuedConnection, Q_ARG(void*, s), Q_ARG(bool, true)); } diff --git a/src/plugins/pulseaudio/qpulseaudioengine.cpp b/src/plugins/pulseaudio/qpulseaudioengine.cpp index e9510fd6a..b3d5044b7 100644 --- a/src/plugins/pulseaudio/qpulseaudioengine.cpp +++ b/src/plugins/pulseaudio/qpulseaudioengine.cpp @@ -170,15 +170,30 @@ static void event_cb(pa_context* context, pa_subscription_event_type_t t, uint32 case PA_SUBSCRIPTION_EVENT_NEW: case PA_SUBSCRIPTION_EVENT_CHANGE: switch (facility) { - case PA_SUBSCRIPTION_EVENT_SERVER: - pa_operation_unref(pa_context_get_server_info(context, serverInfoCallback, userdata)); + case PA_SUBSCRIPTION_EVENT_SERVER: { + pa_operation *op = pa_context_get_server_info(context, serverInfoCallback, userdata); + if (op) + pa_operation_unref(op); + else + qWarning("PulseAudioService: failed to get server info"); break; - case PA_SUBSCRIPTION_EVENT_SINK: - pa_operation_unref(pa_context_get_sink_info_by_index(context, index, sinkInfoCallback, userdata)); + } + case PA_SUBSCRIPTION_EVENT_SINK: { + pa_operation *op = pa_context_get_sink_info_by_index(context, index, sinkInfoCallback, userdata); + if (op) + pa_operation_unref(op); + else + qWarning("PulseAudioService: failed to get sink info"); break; - case PA_SUBSCRIPTION_EVENT_SOURCE: - pa_operation_unref(pa_context_get_source_info_by_index(context, index, sourceInfoCallback, userdata)); + } + case PA_SUBSCRIPTION_EVENT_SOURCE: { + pa_operation *op = pa_context_get_source_info_by_index(context, index, sourceInfoCallback, userdata); + if (op) + pa_operation_unref(op); + else + qWarning("PulseAudioService: failed to get source info"); break; + } default: break; } @@ -328,11 +343,15 @@ void QPulseAudioEngine::prepare() pa_context_set_state_callback(m_context, contextStateCallback, this); pa_context_set_subscribe_callback(m_context, event_cb, this); - pa_operation_unref(pa_context_subscribe(m_context, + pa_operation *op = pa_context_subscribe(m_context, pa_subscription_mask_t(PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE | PA_SUBSCRIPTION_MASK_SERVER), - NULL, NULL)); + NULL, NULL); + if (op) + pa_operation_unref(op); + else + qWarning("PulseAudioService: failed to subscribe to context notifications"); } else { pa_context_unref(m_context); m_context = 0; @@ -376,21 +395,33 @@ void QPulseAudioEngine::updateDevices() // Get default input and output devices pa_operation *operation = pa_context_get_server_info(m_context, serverInfoCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); + if (operation) { + while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) + pa_threaded_mainloop_wait(m_mainLoop); + pa_operation_unref(operation); + } else { + qWarning("PulseAudioService: failed to get server info"); + } // Get output devices operation = pa_context_get_sink_info_list(m_context, sinkInfoCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); + if (operation) { + while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) + pa_threaded_mainloop_wait(m_mainLoop); + pa_operation_unref(operation); + } else { + qWarning("PulseAudioService: failed to get sink info"); + } // Get input devices operation = pa_context_get_source_info_list(m_context, sourceInfoCallback, this); - while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) - pa_threaded_mainloop_wait(m_mainLoop); - pa_operation_unref(operation); + if (operation) { + while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING) + pa_threaded_mainloop_wait(m_mainLoop); + pa_operation_unref(operation); + } else { + qWarning("PulseAudioService: failed to get source info"); + } unlock(); } -- cgit v1.2.3 From 6b94b3ca91df6ee047e99c63061dc33b1fb1c0f7 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 21 Sep 2016 12:01:23 +0300 Subject: GStreamer: print a warning when the camerabin plugin is missing Don't create the camera service when the camerabin plugin is not available on the system and print a warning. Task-number: QTBUG-50775 Change-Id: I56c7e6297bebe4b90596cb3c0323f1d38231bceb Reviewed-by: Christian Stromme --- src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp index bee81a953..0658b0af0 100644 --- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp @@ -60,8 +60,19 @@ QMediaService* CameraBinServicePlugin::create(const QString &key) { QGstUtils::initializeGst(); - if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) + if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) { + if (!CameraBinService::isCameraBinAvailable()) { + guint major, minor, micro, nano; + gst_version(&major, &minor, µ, &nano); + qWarning("Error: cannot create camera service, the 'camerabin' plugin is missing for " + "GStreamer %u.%u." + "\nPlease install the 'bad' GStreamer plugin package.", + major, minor); + return Q_NULLPTR; + } + return new CameraBinService(sourceFactory()); + } qWarning() << "Gstreamer camerabin service plugin: unsupported key:" << key; return 0; -- cgit v1.2.3 From 7d00a457e455e159a3dde30ad798be744cf38bb1 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 21 Sep 2016 10:59:20 +0300 Subject: Stabilize tst_QAudioOutput::pullSuspendResume() Don't wait after resume(); the test is meant to check the state of the QAudioOutput right after the call, not later. The state and the error status are supposed to change immediately, even if the backend runs in another thread. Ignore any state change that can happen because of underrun errors (likely to happen on CI). Removed the test from blacklist. Change-Id: Idaef6a9e0dfcfc89424fb2383cf3830a3184f975 Reviewed-by: Milla Pohjanheimo Reviewed-by: Christian Stromme --- tests/auto/integration/qaudiooutput/BLACKLIST | 5 ----- tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp | 7 ++----- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 tests/auto/integration/qaudiooutput/BLACKLIST diff --git a/tests/auto/integration/qaudiooutput/BLACKLIST b/tests/auto/integration/qaudiooutput/BLACKLIST deleted file mode 100644 index 4d45efe06..000000000 --- a/tests/auto/integration/qaudiooutput/BLACKLIST +++ /dev/null @@ -1,5 +0,0 @@ -[pullSuspendResume] -redhatenterpriselinuxworkstation-6.6 -rhel-7.1 -ubuntu-14.04 -opensuse-13.1 64bit diff --git a/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp index b887d3f9a..dfe9d3e54 100644 --- a/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp @@ -612,9 +612,6 @@ void tst_QAudioOutput::pullSuspendResume() audioOutput.resume(); - // Give backends running in separate threads a chance to suspend. - QTest::qWait(100); - // Check that QAudioOutput immediately transitions to ActiveState QVERIFY2((stateSignal.count() == 1), QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData()); @@ -626,8 +623,8 @@ void tst_QAudioOutput::pullSuspendResume() QTest::qWait(3000); // 3 seconds should be plenty QVERIFY2(audioFile->atEnd(), "didn't play to EOF"); - QVERIFY2((stateSignal.count() == 1), - QString("didn't emit IdleState signal when at EOF, got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData()); + QVERIFY(stateSignal.count() > 0); + QCOMPARE(qvariant_cast(stateSignal.last().at(0)), QAudio::IdleState); QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transitions to IdleState when at EOF"); stateSignal.clear(); -- cgit v1.2.3