From ee6d4dfc144db08e640a9b36d3cdaf7e9cd4e613 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Wed, 9 Aug 2017 17:50:20 -0700 Subject: [PATCH] If real input device fails to start, use dummy input --- libraries/audio-client/src/AudioClient.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 9b97afc6a2..b7026e83b9 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -1498,18 +1498,24 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceIn supportedFormat = true; } else { qCDebug(audioclient) << "Error starting audio input -" << _audioInput->error(); + _audioInput->deleteLater(); + _audioInput = NULL; } } } } - // If there is no input device, use the dummy input device. + // If there is no working input device, use the dummy input device. // It generates audio callbacks on a timer to simulate a mic stream of silent packets. // This enables clients without a mic to still receive an audio stream from the mixer. if (!_audioInput) { - qCDebug(audioclient) << "No audio input device is available, using dummy input."; + qCDebug(audioclient) << "Audio input device is not available, using dummy input."; + _inputDeviceInfo = QAudioDeviceInfo();; + emit deviceChanged(QAudio::AudioInput, _inputDeviceInfo); _inputFormat = _desiredInputFormat; + qCDebug(audioclient) << "The format to be used for audio input is" << _inputFormat; + qCDebug(audioclient) << "No resampling required for audio input to match desired network format."; _audioGate = new AudioGate(_desiredInputFormat.sampleRate(), _desiredInputFormat.channelCount()); qCDebug(audioclient) << "Noise gate created with" << _desiredInputFormat.channelCount() << "channels.";