Bugfixes (that could potentially segfault) in PortAudio backend.
All checks were successful
Building, testing and releasing LASP if it has a tag / Build-Test-Ubuntu (push) Successful in 2m54s
Building, testing and releasing LASP if it has a tag / Release-Ubuntu (push) Successful in 2s

This commit is contained in:
Anne de Jong 2024-01-19 12:35:56 +01:00
parent 46bef007ca
commit 373dcfb60f
2 changed files with 8 additions and 2 deletions

View File

@ -69,6 +69,8 @@ void fillPortAudioDeviceInfo(DeviceInfoList &devinfolist) {
} }
OurPaDeviceInfo d; OurPaDeviceInfo d;
d._paDevInfo = *deviceInfo; d._paDevInfo = *deviceInfo;
// We store the name in d.device_name
d._paDevInfo.name = nullptr;
d.api = portaudioApi; d.api = portaudioApi;
d.device_name = deviceInfo->name; d.device_name = deviceInfo->name;
@ -87,6 +89,9 @@ void fillPortAudioDeviceInfo(DeviceInfoList &devinfolist) {
d.prefFramesPerBlockIndex = 2; d.prefFramesPerBlockIndex = 2;
d.availableInputRanges = {1.0}; d.availableInputRanges = {1.0};
// d.prefInputRangeIndex = 0; // Constructor-defined
d.availableOutputRanges = {1.0};
// d.prefOutputRangeIndex = 0; // Constructor-defined
d.ninchannels = deviceInfo->maxInputChannels; d.ninchannels = deviceInfo->maxInputChannels;
d.noutchannels = deviceInfo->maxOutputChannels; d.noutchannels = deviceInfo->maxOutputChannels;
@ -194,12 +199,13 @@ PortAudioDaq::PortAudioDaq(const OurPaDeviceInfo &devinfo_gen,
// the index, as this is required in the PaStreamParameters struct // the index, as this is required in the PaStreamParameters struct
int devindex = -1; int devindex = -1;
for (int i = 0; i < Pa_GetDeviceCount(); i++) { for (int i = 0; i < Pa_GetDeviceCount(); i++) {
// DEBUGTRACE_PRINT(i);
bool ok = true; bool ok = true;
const PaDeviceInfo *info = Pa_GetDeviceInfo(i); const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
if (!info) { if (!info) {
throw rte("No device structure returned from PortAudio"); throw rte("No device structure returned from PortAudio");
} }
ok &= string(info->name) == devinfo_gen._paDevInfo.name; ok &= string(info->name) == devinfo_gen.device_name;
ok &= info->hostApi == devinfo_gen._paDevInfo.hostApi; ok &= info->hostApi == devinfo_gen._paDevInfo.hostApi;
ok &= info->maxInputChannels == devinfo_gen._paDevInfo.maxInputChannels; ok &= info->maxInputChannels == devinfo_gen._paDevInfo.maxInputChannels;
ok &= info->maxOutputChannels == devinfo_gen._paDevInfo.maxOutputChannels; ok &= info->maxOutputChannels == devinfo_gen._paDevInfo.maxOutputChannels;

@ -1 +1 @@
Subproject commit cb8d3dcbc6fa74c67f3e236be89b12d5630da141 Subproject commit daaf637f6f9fce670031221abfd7dfde92e5cce3