From ff7884e635ca402e7ca8cd1ea230fb6792b81a65 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Thu, 21 Jan 2016 21:24:49 -0800 Subject: ao_wasapi: exit earlier if there are zero playback devices found Previously, if the enumerator found no devices, attempting to get the default device with IMMDeviceEnumerator::GetDefaultAudioEndpoint would result in the cryptic (and undocumented) E_PROP_ID_UNSUPPORTED. This way, the user is given a better indication of what exactly is wrong and isolates any other possible triggers for this error. --- audio/out/ao_wasapi_utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index c5e1eab455..2768104cb4 100644 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -873,6 +873,11 @@ LPWSTR find_deviceID(struct ao *ao) if (!enumerator) goto exit_label; + if (!enumerator->count) { + MP_ERR(ao, "There are no playback devices available\n"); + goto exit_label; + } + if (!device.len) { MP_VERBOSE(ao, "No device specified. Selecting default.\n"); d = default_device_desc(enumerator); -- cgit v1.2.3