Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.8.0 Alpha
-
None
-
WinRT
-
-
36db73a319a45f5aab579fd9d7031c5ab09f2757
Description
Regression caused by Change-Id: I8ace78858976fe7c60a2c4a117ef15c4e1bb177f
This change adds a new QWasapiUtils::defaultDevice(...) that by-passes QWasapiUtils::availableDevices(...), but unfortunately availableDevices has couple of side effects that are not triggered.
Namely it fills these global mappings
QList<QByteArray> &deviceNames = mode == QAudio::AudioInput ? gMapping->inputDeviceNames : gMapping->outputDeviceNames; QList<QString> &deviceIds = mode == QAudio::AudioInput ? gMapping->inputDeviceIds : gMapping->outputDeviceIds;
While enumerating devices. Later on when QWasapiUtils::createOrGetInterface is called it will always fail/assert when is called either in:
Q_ASSERT((mode == QAudio::AudioInput ? gMapping->inputDeviceNames.indexOf(dev) : gMapping->outputDeviceNames.indexOf(dev)) != -1);
Or crash/fail few lines below in:
QString id = mode == QAudio::AudioInput ? gMapping->inputDeviceIds.at(gMapping->inputDeviceNames.indexOf(dev)) : gMapping->outputDeviceIds.at(gMapping->outputDeviceNames.indexOf(dev));
Secondly even if QAudioDeviceInfo::availableDevices(...) is called to force population of theses list it will still fail because the dev parameter that is being passed is no longer device name, but the actual id (did not analyze futher).
Workaround, never invoke QAudioDeviceInfo::defaultInputDevice() / QAudioDeviceInfo::defaultOutputDevice() under WinRT. Just enumerate manually using QAudioDeviceInfo::availableDevices(...), but hopefully fixed before 5.8 release.