1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-27 00:34:16 +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() {
HRESULT hr_coinit = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (hr_coinit != S_OK && hr_coinit != S_FALSE) {
return QList<Device>();
}
QList<Device> devices;
Device default_device;
@ -77,18 +74,39 @@ QList<DeviceFinder::Device> MMDeviceFinder::ListDevices() {
devices.append(device);
PropVariantClear(&var_name);
}
else {
qLog(Error) << "IPropertyStore::GetValue failed." << Qt::hex << DWORD(hr);
}
props->Release();
}
else {
qLog(Error) << "IPropertyStore::OpenPropertyStore failed." << Qt::hex << DWORD(hr);
}
CoTaskMemFree(pwszid);
}
else {
qLog(Error) << "IMMDevice::GetId failed." << Qt::hex << DWORD(hr);
}
endpoint->Release();
}
else {
qLog(Error) << "IMMDeviceCollection::Item failed." << Qt::hex << DWORD(hr);
}
}
}
else {
qLog(Error) << "IMMDeviceCollection::GetCount failed." << Qt::hex << DWORD(hr);
}
collection->Release();
}
else {
qLog(Error) << "EnumAudioEndpoints failed." << Qt::hex << DWORD(hr);
}
enumerator->Release();
}
else {
qLog(Error) << "CoCreateInstance failed." << Qt::hex << DWORD(hr);
}
if (hr_coinit == S_OK || hr_coinit == S_FALSE) CoUninitialize();