mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 19:59:20 +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);
|
||||
_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
|
||||
if (_audioOutput) {
|
||||
_audioOutputIODevice.close();
|
||||
|
@ -2342,9 +2347,9 @@ qint64 AudioClient::AudioOutputIODevice::readData(char * data, qint64 maxSize) {
|
|||
qCDebug(audiostream, "Read %d samples from injectors (%d available, %d requested)", injectorSamplesPopped, _localInjectorsStream.samplesAvailable(), samplesRequested);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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