summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikko Hallamaa <mikko.hallamaa@qt.io>2024-03-25 13:20:18 +0100
committerMikko Hallamaa <mikko.hallamaa@qt.io>2024-04-04 11:12:53 +0100
commitb981a7446b2a8caf53450a8624e7311c762ff164 (patch)
treedac8a15bbb596d13649073f8d19f14b66b118071
parenteab27c5cbd63b0ae81974f6c56c93ddac067cf89 (diff)
PulseAudio: Streamline resetting source on start() calls
This patch replaces the audio source deletion and close() call in start() calls of QPulseAudioSource with a single reset() call. Audio source is deleted in close(). Pick-to: 6.7 6.6 6.5 Change-Id: I6fc48cc347404a33992c89ca9223f0366808e140 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
-rw-r--r--src/multimedia/pulseaudio/qpulseaudiosource.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/multimedia/pulseaudio/qpulseaudiosource.cpp b/src/multimedia/pulseaudio/qpulseaudiosource.cpp
index 3e5fba419..e77f4bcb2 100644
--- a/src/multimedia/pulseaudio/qpulseaudiosource.cpp
+++ b/src/multimedia/pulseaudio/qpulseaudiosource.cpp
@@ -135,14 +135,7 @@ QAudioFormat QPulseAudioSource::format() const
void QPulseAudioSource::start(QIODevice *device)
{
- m_stateMachine.stopOrUpdateError();
-
- if (!m_pullMode && m_audioSource) {
- delete m_audioSource;
- m_audioSource = nullptr;
- }
-
- close();
+ reset();
if (!open())
return;
@@ -155,14 +148,7 @@ void QPulseAudioSource::start(QIODevice *device)
QIODevice *QPulseAudioSource::start()
{
- m_stateMachine.stopOrUpdateError();
-
- if (!m_pullMode && m_audioSource) {
- delete m_audioSource;
- m_audioSource = nullptr;
- }
-
- close();
+ reset();
if (!open())
return nullptr;