diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-05-11 10:30:24 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-05-17 10:34:02 +0000 |
commit | 65d06e5445519e7b8094460e6d1d7983fa8cbaee (patch) | |
tree | 164b1a4461d37e059c9d3713be847a9858589631 /src/multimedia | |
parent | ae920366f30d9b4ddd47d055732fb87123c59b87 (diff) |
Fix the QSoundEffect autotest on gstreamer
Change-Id: Ifd0001934b6074601a78f3513694e2637a9baf8d
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/audio/qsoundeffect.cpp | 18 | ||||
-rw-r--r-- | src/multimedia/platform/gstreamer/audio/qaudiooutput_gstreamer_p.h | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/multimedia/audio/qsoundeffect.cpp b/src/multimedia/audio/qsoundeffect.cpp index 453d0f6a2..51809bf26 100644 --- a/src/multimedia/audio/qsoundeffect.cpp +++ b/src/multimedia/audio/qsoundeffect.cpp @@ -181,6 +181,8 @@ qint64 QSoundEffectPrivate::readData(char *data, qint64 len) m_offset = 0; } } + if (!m_runningCount) + setPlaying(false); return bytesWritten; } @@ -215,10 +217,17 @@ void QSoundEffectPrivate::setStatus(QSoundEffect::Status status) void QSoundEffectPrivate::setPlaying(bool playing) { - qCDebug(qLcSoundEffect) << this << "setPlaying(" << playing << ")"; + qCDebug(qLcSoundEffect) << this << "setPlaying(" << playing << ")" << m_playing; if (m_playing == playing) return; m_playing = playing; + if (m_audioOutput) { + if (!m_playing) + m_audioOutput->stop(); + else if (m_audioOutput->state() == QAudio::StoppedState && m_sampleReady) + m_audioOutput->start(this); + } + emit q_ptr->playingChanged(); } @@ -628,14 +637,12 @@ void QSoundEffect::play() { d->m_offset = 0; d->setLoopsRemaining(d->m_loopCount); - qCDebug(qLcSoundEffect) << this << "play"; + qCDebug(qLcSoundEffect) << this << "play" << d->m_loopCount << d->m_runningCount; if (d->m_status == QSoundEffect::Null || d->m_status == QSoundEffect::Error) { d->setStatus(QSoundEffect::Null); return; } d->setPlaying(true); - if (d->m_audioOutput && d->m_audioOutput->state() == QAudio::StoppedState && d->m_sampleReady) - d->m_audioOutput->start(d); } /*! @@ -781,9 +788,6 @@ void QSoundEffect::stop() d->m_offset = 0; d->setPlaying(false); - - if (d->m_audioOutput) - d->m_audioOutput->stop(); } /* Signals */ diff --git a/src/multimedia/platform/gstreamer/audio/qaudiooutput_gstreamer_p.h b/src/multimedia/platform/gstreamer/audio/qaudiooutput_gstreamer_p.h index c1c7bae8d..5e41cb7d3 100644 --- a/src/multimedia/platform/gstreamer/audio/qaudiooutput_gstreamer_p.h +++ b/src/multimedia/platform/gstreamer/audio/qaudiooutput_gstreamer_p.h @@ -125,7 +125,6 @@ private: int m_bufferSize = 0; qint64 m_bytesProcessed = 0; QElapsedTimer m_timeStamp; - QString m_category; qreal m_volume = 1.; QByteArray pushData; |