summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@qt.io>2016-07-20 13:15:20 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-08-15 10:07:05 +0000
commitc9de25fa342ff8066d49541179c30d0ce45950b4 (patch)
tree72c3ecc797c13b7cb50ed87a4e0f784d9305cae6
parentc7ae48c5fb5005efae05f2cabdeee7117f6f72fa (diff)
PulseAudio (QSoundEffect): don't write data to an unready stream
The PulseAudio stream must be ready to write data to it, otherwise an assert is raised. Change-Id: Iaa108124a135b018aa84845a37665895a005f380 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
index 48f3333c..1fb10d12 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
@@ -736,6 +736,10 @@ void QSoundEffectPrivate::prepare()
if (!m_pulseStream || !m_sampleReady)
return;
PulseDaemonLocker locker;
+
+ if (pa_stream_get_state(m_pulseStream) != PA_STREAM_READY)
+ return;
+
pa_stream_set_write_callback(m_pulseStream, stream_write_callback, this);
pa_stream_set_underflow_callback(m_pulseStream, stream_underrun_callback, this);
m_stopping = false;