summaryrefslogtreecommitdiffstats
path: root/src/plugins/pulseaudio/qpulseaudioengine.h
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2014-06-12 18:48:15 +0200
committerYoann Lopes <yoann.lopes@digia.com>2014-07-10 15:59:37 +0200
commit85f4b8177ca10e7e16ccc3065370589630400f2b (patch)
treef27f1bd6282b0d3038d8f991c6772399235b90de /src/plugins/pulseaudio/qpulseaudioengine.h
parent8da61153c9b4e505b6f8a0e7a6c630690516d845 (diff)
PulseAudio: make plugin more robust.
Handle more thoroughly error cases, such as when the PulseAudio daemon does not respond or terminates while QAudioInput/QAudioOutput is active, in which cases it used to crash or hang. We now correctly emit the error signal and change the state when errors occur. Task-number: QTBUG-29742 Change-Id: I173d35aece60d96e578785e1522cf78b24dcb8b8 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/pulseaudio/qpulseaudioengine.h')
-rw-r--r--src/plugins/pulseaudio/qpulseaudioengine.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/plugins/pulseaudio/qpulseaudioengine.h b/src/plugins/pulseaudio/qpulseaudioengine.h
index 1c6c2aaf4..04591d035 100644
--- a/src/plugins/pulseaudio/qpulseaudioengine.h
+++ b/src/plugins/pulseaudio/qpulseaudioengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
@@ -74,12 +74,36 @@ public:
pa_threaded_mainloop *mainloop() { return m_mainLoop; }
pa_context *context() { return m_context; }
+ inline void lock()
+ {
+ if (m_mainLoop)
+ pa_threaded_mainloop_lock(m_mainLoop);
+ }
+
+ inline void unlock()
+ {
+ if (m_mainLoop)
+ pa_threaded_mainloop_unlock(m_mainLoop);
+ }
+
+ inline void wait(pa_operation *op)
+ {
+ while (m_mainLoop && pa_operation_get_state(op) == PA_OPERATION_RUNNING)
+ pa_threaded_mainloop_wait(m_mainLoop);
+ }
+
QList<QByteArray> availableDevices(QAudio::Mode mode) const;
+Q_SIGNALS:
+ void contextFailed();
+
+private Q_SLOTS:
+ void prepare();
+ void onContextFailed();
+
private:
- void serverInfo();
- void sinks();
- void sources();
+ void updateDevices();
+ void release();
public:
QList<QByteArray> m_sinks;
@@ -93,6 +117,7 @@ private:
pa_mainloop_api *m_mainLoopApi;
pa_threaded_mainloop *m_mainLoop;
pa_context *m_context;
+ bool m_prepared;
};
QT_END_NAMESPACE