Don't initialize volume on pulse audio input by default.

Task-number: QTBUG-49461
Change-Id: I32b707e19091ab8344175b2dc0cdd1747f1186b3
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
Morten Minde Neergaard
2015-11-13 19:21:35 +01:00
committed by Yoann Lopes
parent c106041bd6
commit 4a2c597a06
2 changed files with 5 additions and 1 deletions

View File

@@ -150,6 +150,7 @@ QPulseAudioInput::QPulseAudioInput(const QByteArray &device)
, m_errorState(QAudio::NoError)
, m_deviceState(QAudio::StoppedState)
, m_volume(qreal(1.0f))
, m_customVolumeRequired(false)
, m_pullMode(true)
, m_opened(false)
, m_bytesAvailable(0)
@@ -355,7 +356,8 @@ bool QPulseAudioInput::open()
if (actualBufferAttr->tlength != (uint32_t)-1)
m_bufferSize = actualBufferAttr->tlength;
setPulseVolume();
if (m_customVolumeRequired)
setPulseVolume();
pulseEngine->unlock();
@@ -568,6 +570,7 @@ void QPulseAudioInput::setVolume(qreal vol)
if (vol >= 0.0 && vol <= 1.0) {
QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
pulseEngine->lock();
m_customVolumeRequired = true;
if (!qFuzzyCompare(m_volume, vol)) {
m_volume = vol;
if (m_opened) {

View File

@@ -100,6 +100,7 @@ public:
QAudio::Error m_errorState;
QAudio::State m_deviceState;
qreal m_volume;
bool m_customVolumeRequired;
pa_cvolume m_chVolume;
private slots: