1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-28 09:10:58 +01:00

Log errors in MM device finder

This commit is contained in:
Jonas Kvinge 2020-10-17 03:19:13 +02:00
parent e45521c6c0
commit c30fb0d38c

View File

@ -37,9 +37,6 @@ MMDeviceFinder::MMDeviceFinder() : DeviceFinder("mmdevice", { "wasapisink" }) {}
QList<DeviceFinder::Device> MMDeviceFinder::ListDevices() { QList<DeviceFinder::Device> MMDeviceFinder::ListDevices() {
HRESULT hr_coinit = CoInitializeEx(NULL, COINIT_MULTITHREADED); HRESULT hr_coinit = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (hr_coinit != S_OK && hr_coinit != S_FALSE) {
return QList<Device>();
}
QList<Device> devices; QList<Device> devices;
Device default_device; Device default_device;
@ -77,18 +74,39 @@ QList<DeviceFinder::Device> MMDeviceFinder::ListDevices() {
devices.append(device); devices.append(device);
PropVariantClear(&var_name); PropVariantClear(&var_name);
} }
else {
qLog(Error) << "IPropertyStore::GetValue failed." << Qt::hex << DWORD(hr);
}
props->Release(); props->Release();
} }
else {
qLog(Error) << "IPropertyStore::OpenPropertyStore failed." << Qt::hex << DWORD(hr);
}
CoTaskMemFree(pwszid); CoTaskMemFree(pwszid);
} }
else {
qLog(Error) << "IMMDevice::GetId failed." << Qt::hex << DWORD(hr);
}
endpoint->Release(); endpoint->Release();
} }
else {
qLog(Error) << "IMMDeviceCollection::Item failed." << Qt::hex << DWORD(hr);
} }
} }
}
else {
qLog(Error) << "IMMDeviceCollection::GetCount failed." << Qt::hex << DWORD(hr);
}
collection->Release(); collection->Release();
} }
else {
qLog(Error) << "EnumAudioEndpoints failed." << Qt::hex << DWORD(hr);
}
enumerator->Release(); enumerator->Release();
} }
else {
qLog(Error) << "CoCreateInstance failed." << Qt::hex << DWORD(hr);
}
if (hr_coinit == S_OK || hr_coinit == S_FALSE) CoUninitialize(); if (hr_coinit == S_OK || hr_coinit == S_FALSE) CoUninitialize();