added mutex for audio handler

This commit is contained in:
luiscuenca 2017-12-13 16:11:46 -07:00
parent e709561a62
commit e581c66b56
2 changed files with 4 additions and 1 deletions

View file

@ -680,7 +680,9 @@ void OffscreenQmlSurface::create() {
// Setup the update of the QML media components with the current audio output device
QObject::connect(&_audioOutputUpdateTimer, &QTimer::timeout, this, [this]() {
if (_currentAudioOutputDevice.size() > 0) {
new AudioHandler(sharedFromThis(), _currentAudioOutputDevice);
QMutexLocker lock(&_audioHandlerMutex);
QString audioDeviceName = _currentAudioOutputDevice;
new AudioHandler(sharedFromThis(), audioDeviceName);
}
});
int waitForAudioQmlMs = 200;

View file

@ -173,6 +173,7 @@ private:
uint64_t _lastRenderTime { 0 };
uvec2 _size;
QMutex _audioHandlerMutex;
QTimer _audioOutputUpdateTimer;
QString _currentAudioOutputDevice;