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