mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 08:44:04 +02:00
WASAPI: Fix an error with device enumeration.
There are two problems with this: * The pInfo buffer is being accessed when set to NULL * The count is not getting set correctly when pInfo = NULL
This commit is contained in:
@@ -3076,7 +3076,9 @@ static mal_result mal_enumerate_devices__wasapi(mal_context* pContext, mal_devic
|
|||||||
return mal_context_post_error(pContext, NULL, "[WASAPI] Failed to get device count.", MAL_NO_DEVICE);
|
return mal_context_post_error(pContext, NULL, "[WASAPI] Failed to get device count.", MAL_NO_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mal_uint32 iDevice = 0; iDevice < infoSize && iDevice < count; ++iDevice) {
|
for (mal_uint32 iDevice = 0; iDevice < count; ++iDevice) {
|
||||||
|
if (pInfo != NULL) {
|
||||||
|
if (infoSize > 0) {
|
||||||
mal_zero_object(pInfo);
|
mal_zero_object(pInfo);
|
||||||
|
|
||||||
IMMDevice* pDevice;
|
IMMDevice* pDevice;
|
||||||
@@ -3116,8 +3118,13 @@ static mal_result mal_enumerate_devices__wasapi(mal_context* pContext, mal_devic
|
|||||||
}
|
}
|
||||||
|
|
||||||
pInfo += 1;
|
pInfo += 1;
|
||||||
|
infoSize -= 1;
|
||||||
*pCount += 1;
|
*pCount += 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
*pCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IMMDeviceCollection_Release(pDeviceCollection);
|
IMMDeviceCollection_Release(pDeviceCollection);
|
||||||
#else
|
#else
|
||||||
@@ -10217,6 +10224,7 @@ void mal_pcm_f32_to_s32(int* pOut, const float* pIn, unsigned int count)
|
|||||||
// which is by design.
|
// which is by design.
|
||||||
// - ALSA: Add support for excluding the "null" device using the alsa.excludeNullDevice context config variable.
|
// - ALSA: Add support for excluding the "null" device using the alsa.excludeNullDevice context config variable.
|
||||||
// - ALSA: Fix a bug with channel mapping which causes an assertion to fail.
|
// - ALSA: Fix a bug with channel mapping which causes an assertion to fail.
|
||||||
|
// - WASAPI: Fix device enumeration when passing NULL to the pInfo parameter.
|
||||||
//
|
//
|
||||||
// v0.4 - 2017-11-05
|
// v0.4 - 2017-11-05
|
||||||
// - API CHANGE: The log callback is now per-context rather than per-device and as is thus now passed to
|
// - API CHANGE: The log callback is now per-context rather than per-device and as is thus now passed to
|
||||||
|
|||||||
Reference in New Issue
Block a user