mirror of
https://github.com/lubosz/overte.git
synced 2025-04-15 10:09:02 +02:00
waiting on local injector prep
This commit is contained in:
parent
0a12dc7446
commit
0de812b7b5
2 changed files with 9 additions and 2 deletions
|
@ -2064,6 +2064,11 @@ bool AudioClient::switchOutputToAudioDevice(const HifiAudioDeviceInfo outputDevi
|
|||
Lock localAudioLock(_localAudioMutex);
|
||||
_localSamplesAvailable.exchange(0, std::memory_order_release);
|
||||
|
||||
//wait on local injectors prep to finish running
|
||||
if (_localPrepInjectorFuture.isStarted() || _localPrepInjectorFuture.isRunning()) {
|
||||
_localPrepInjectorFuture.waitForFinished();
|
||||
}
|
||||
|
||||
// cleanup any previously initialized device
|
||||
if (_audioOutput) {
|
||||
_audioOutputIODevice.close();
|
||||
|
@ -2344,7 +2349,7 @@ qint64 AudioClient::AudioOutputIODevice::readData(char * data, qint64 maxSize) {
|
|||
}
|
||||
|
||||
// prepare injectors for the next callback
|
||||
QtConcurrent::run(QThreadPool::globalInstance(), [this] {
|
||||
_audio->_localPrepInjectorFuture = QtConcurrent::run(QThreadPool::globalInstance(), [this] {
|
||||
_audio->prepareLocalAudioInjectors();
|
||||
});
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include <QFuture>
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
|
@ -506,7 +507,8 @@ private:
|
|||
#endif
|
||||
|
||||
AudioSolo _solo;
|
||||
|
||||
|
||||
QFuture<void> _localPrepInjectorFuture;
|
||||
QReadWriteLock _hmdNameLock;
|
||||
Mutex _checkDevicesMutex;
|
||||
QTimer* _checkDevicesTimer { nullptr };
|
||||
|
|
Loading…
Reference in a new issue