diff options
author | Andreas Holzammer <andreas.holzammer@kdab.com> | 2021-07-31 06:05:57 +0200 |
---|---|---|
committer | Andreas Holzammer <andreas.holzammer@kdab.com> | 2021-10-01 10:05:36 +0200 |
commit | e760a6aae78f6a41ec0430c9e242b449a3a217a8 (patch) | |
tree | 8dcf7e53fac89710e0f446c019edc1871916db5f | |
parent | d23fcd68bc3c514fbda822605c3aa6cbda1c043c (diff) |
PulseAudio: Call pa_stream_flush() with PulseDaemonLocker lock held
The pa_stream_flush() must be called with pa_threaded_mainloop_lock()
held, otherwise it is possible to corrupt internal PA state. The
PulseDaemonLocker implements this lock and other pa_stream_flush()
instances within qsoundeffect_pulse_p.cpp already instantiate the
PulseDaemonLocker to claim the pa_threaded_mainloop_lock(). Add the
missing locking to ::setVolume pa_stream_flush() call too.
Change-Id: I667b1df669f839737c6cedb62ff66b612bdd65a0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/multimedia/audio/qsoundeffect_pulse_p.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index 5c15d4a6a..04c33a93e 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -552,8 +552,10 @@ void QSoundEffectPrivate::setVolume(qreal volume) m_volume = qBound(qreal(0), volume, qreal(1)); locker.unlock(); - if (!m_playing && m_pulseStream) + if (!m_playing && m_pulseStream) { + PulseDaemonLocker locker; pa_stream_flush(m_pulseStream, volume_stream_flush_callback, m_ref->getRef()); + } emit volumeChanged(); } |