mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
moved call to hmd device name prior to locking device mutex
This commit is contained in:
parent
ac8b664537
commit
5dd5447095
1 changed files with 6 additions and 3 deletions
|
@ -83,7 +83,6 @@ Mutex _recordMutex;
|
|||
|
||||
HifiAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode);
|
||||
|
||||
|
||||
static QString getHmdAudioDeviceName(QAudio::Mode mode) {
|
||||
foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getAllDisplayPlugins()) {
|
||||
if (displayPlugin && displayPlugin->isHmd()) {
|
||||
|
@ -100,6 +99,10 @@ static QString getHmdAudioDeviceName(QAudio::Mode mode) {
|
|||
|
||||
// thread-safe
|
||||
QList<HifiAudioDeviceInfo> getAvailableDevices(QAudio::Mode mode) {
|
||||
//get hmd device name prior to locking device mutex. in case of shutdown, this thread will be locked and audio client
|
||||
//cannot properly shut down.
|
||||
QString hmdDeviceName = getHmdAudioDeviceName(mode);
|
||||
|
||||
// NOTE: availableDevices() clobbers the Qt internal device list
|
||||
Lock lock(_deviceMutex);
|
||||
auto devices = QAudioDeviceInfo::availableDevices(mode);
|
||||
|
@ -110,8 +113,7 @@ QList<HifiAudioDeviceInfo> getAvailableDevices(QAudio::Mode mode) {
|
|||
}
|
||||
|
||||
newDevices.push_front(defaultAudioDeviceForMode(mode));
|
||||
|
||||
QString hmdDeviceName = getHmdAudioDeviceName(mode);
|
||||
|
||||
if (!hmdDeviceName.isNull() && !hmdDeviceName.isEmpty()) {
|
||||
HifiAudioDeviceInfo hmdDevice;
|
||||
foreach(auto device, newDevices) {
|
||||
|
@ -803,6 +805,7 @@ void AudioClient::stop() {
|
|||
// Destruction of the pointers will occur when the parent object (this) is destroyed)
|
||||
{
|
||||
Lock lock(_checkDevicesMutex);
|
||||
_checkDevicesTimer->stop();
|
||||
_checkDevicesTimer = nullptr;
|
||||
}
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue