diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-01-15 12:16:37 +0100 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-05-09 07:17:38 +0000 |
commit | 83542fd6b134b1fb70b085e62819c3e742a9e31f (patch) | |
tree | 592216738de87cdac16af0ad22665e55e495bcf3 /src/multimedia | |
parent | a0049de16d9e2a92b8d31b1ee6943c994ffdf7d2 (diff) | |
download | qtmultimedia-83542fd6b134b1fb70b085e62819c3e742a9e31f.tar.gz |
QSoundEffect: Release QAudioOutput when new source url applied
When sample is ready QAudioOutput is created with sample's format.
In case when new source url is applied old format is reused in
QAudioOutput instance
which might lead incorrect playback.
Task-number: QTBUG-54262
Change-Id: I84af167412cb53726593a3bfd4193fc7cd71f332
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/audio/qsoundeffect_qaudio_p.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp index 388f84d91..3f315fa28 100644 --- a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp +++ b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp @@ -132,6 +132,13 @@ void QSoundEffectPrivate::setSource(const QUrl &url) d->m_sample = nullptr; } + if (d->m_audioOutput) { + disconnect(d->m_audioOutput, &QAudioOutput::stateChanged, d, &PrivateSoundSource::stateChanged); + d->m_audioOutput->stop(); + d->m_audioOutput->deleteLater(); + d->m_audioOutput = nullptr; + } + setStatus(QSoundEffect::Loading); d->m_sample = sampleCache()->requestSample(url); connect(d->m_sample, &QSample::error, d, &PrivateSoundSource::decoderError); |