summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2016-08-22 20:12:23 +0200
committerChristian Stromme <christian.stromme@qt.io>2016-08-24 11:58:41 +0000
commit91d28b48cd7c3ffda21b6d961df29b6aab1caed1 (patch)
tree608da0b863eeb2a5ab91bc138272364287781bd1
parent7c7a97809b686869d19603bf828a468f3d6e274e (diff)
OpenSL ES: Stop the device if it's not stopped already
Change-Id: I4a9906d2d5aa1eaf8e67773f79ca217150a53ce5 Reviewed-by: Michael Dippold <michael.dippold@us.thalesgroup.com> Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
-rw-r--r--src/plugins/opensles/qopenslesaudiooutput.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/opensles/qopenslesaudiooutput.cpp b/src/plugins/opensles/qopenslesaudiooutput.cpp
index cbc6fca5..83691f12 100644
--- a/src/plugins/opensles/qopenslesaudiooutput.cpp
+++ b/src/plugins/opensles/qopenslesaudiooutput.cpp
@@ -110,6 +110,10 @@ QAudio::State QOpenSLESAudioOutput::state() const
void QOpenSLESAudioOutput::start(QIODevice *device)
{
Q_ASSERT(device);
+
+ if (m_state != QAudio::StoppedState)
+ stop();
+
if (!preparePlayer())
return;
@@ -142,6 +146,9 @@ void QOpenSLESAudioOutput::start(QIODevice *device)
QIODevice *QOpenSLESAudioOutput::start()
{
+ if (m_state != QAudio::StoppedState)
+ stop();
+
if (!preparePlayer())
return Q_NULLPTR;