From 87b26d4ad7c96d6c332a6f69e90e005368bcf139 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 7 Jun 2021 14:04:52 +0100 Subject: [PATCH] Check that we have at least 1 audio channel available. --- audiohandler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audiohandler.cpp b/audiohandler.cpp index ca67a16..f051830 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -198,6 +198,12 @@ bool audioHandler::init(audioSetup setupIn) if (format.channelCount() > 2) { format.setChannelCount(2); } + else if (format.channelCount() < 1) + { + qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "No channels found, aborting setup."; + return false; + } + devChannels = format.channelCount(); nativeSampleRate = format.sampleRate(); // chunk size is always relative to Internal Sample Rate.