summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio/qsoundeffect_pulse_p.cpp
diff options
context:
space:
mode:
authorMithra Pattison <mithra.pattison@nokia.com>2012-01-06 12:54:26 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-06 08:42:54 +0100
commit13d75ce063eb6438215c1bbb1cdda1bd2aab10cd (patch)
tree5dcffb14fca65dfceda6722bcd51df28d7559d13 /src/multimedia/audio/qsoundeffect_pulse_p.cpp
parent6b67a11032779ff3a7a78a57e8d2bb2cd8b7e525 (diff)
Fix for QSoundEffect crash bug
When multiple QSoundEffect instances play the same wav source file simultaneously, the system would crash due to some instances not waiting for the underlying pulse audio stream to complete its setup logic. QSoundEffect now waits for the stream to attain the correct state before playing the sound. Change-Id: Ib5a1e6bc3f1cc314054f9cdc89c10100ad546721 Reviewed-by: Ling Hu <ling.hu@nokia.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect_pulse_p.cpp')
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
index 373586ef5..58143fcc2 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
@@ -567,7 +567,7 @@ void QSoundEffectPrivate::play()
return;
PulseDaemonLocker locker;
- if (!m_sampleReady || !m_pulseStream || m_stopping || m_emptying) {
+ if (!m_pulseStream || m_status != QSoundEffect::Ready || m_stopping || m_emptying) {
#ifdef QT_PA_DEBUG
qDebug() << this << "play deferred";
#endif
@@ -794,6 +794,7 @@ void QSoundEffectPrivate::playSample()
qDebug() << this << "playSample";
#endif
Q_ASSERT(m_pulseStream);
+ Q_ASSERT(pa_stream_get_state(m_pulseStream) == PA_STREAM_READY);
pa_operation_unref(pa_stream_cork(m_pulseStream, 0, 0, 0));
}