Check only if at least one audio device is exist on startup

This makes https://github.com/telegramdesktop/tdesktop/issues/1548 don't affect on startup, but only when capture feature is used
This commit is contained in:
Ilya Fedin 2020-05-07 15:38:58 +04:00 committed by John Preston
parent 447d4e6c47
commit 78c3c86fe6
1 changed files with 6 additions and 6 deletions

View File

@ -62,13 +62,13 @@ Instance::Instance() : _inner(new Inner(&_thread)) {
void Instance::check() {
_available = false;
if (auto device = alcCaptureOpenDevice(nullptr, kCaptureFrequency, AL_FORMAT_MONO16, kCaptureFrequency / 5)) {
auto error = ErrorHappened(device);
alcCaptureCloseDevice(device);
_available = !error;
} else {
LOG(("Audio Error: Could not open capture device!"));
if (auto device = alcGetString(0, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) {
if (!QString::fromLocal8Bit(device).isEmpty()) {
_available = true;
return;
}
}
LOG(("Audio Error: No capture device found!"));
}
Instance::~Instance() {