mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 01:15:14 +02:00
Fix getActiveDevice deadlocks on Linux
This commit is contained in:
parent
a75010fb94
commit
e709561a62
1 changed files with 8 additions and 7 deletions
|
@ -679,7 +679,9 @@ void OffscreenQmlSurface::create() {
|
||||||
|
|
||||||
// Setup the update of the QML media components with the current audio output device
|
// Setup the update of the QML media components with the current audio output device
|
||||||
QObject::connect(&_audioOutputUpdateTimer, &QTimer::timeout, this, [this]() {
|
QObject::connect(&_audioOutputUpdateTimer, &QTimer::timeout, this, [this]() {
|
||||||
new AudioHandler(sharedFromThis(), _currentAudioOutputDevice);
|
if (_currentAudioOutputDevice.size() > 0) {
|
||||||
|
new AudioHandler(sharedFromThis(), _currentAudioOutputDevice);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
int waitForAudioQmlMs = 200;
|
int waitForAudioQmlMs = 200;
|
||||||
_audioOutputUpdateTimer.setInterval(waitForAudioQmlMs);
|
_audioOutputUpdateTimer.setInterval(waitForAudioQmlMs);
|
||||||
|
@ -695,6 +697,7 @@ void OffscreenQmlSurface::create() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::changeAudioOutputDevice(const QString& deviceName, bool isHtmlUpdate) {
|
void OffscreenQmlSurface::changeAudioOutputDevice(const QString& deviceName, bool isHtmlUpdate) {
|
||||||
|
_currentAudioOutputDevice = deviceName;
|
||||||
if (_rootItem != nullptr && !isHtmlUpdate) {
|
if (_rootItem != nullptr && !isHtmlUpdate) {
|
||||||
QMetaObject::invokeMethod(this, "forceQmlAudioOutputDeviceUpdate", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "forceQmlAudioOutputDeviceUpdate", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
@ -702,18 +705,16 @@ void OffscreenQmlSurface::changeAudioOutputDevice(const QString& deviceName, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::forceHtmlAudioOutputDeviceUpdate() {
|
void OffscreenQmlSurface::forceHtmlAudioOutputDeviceUpdate() {
|
||||||
auto audioIO = DependencyManager::get<AudioClient>();
|
if (_currentAudioOutputDevice.size() > 0) {
|
||||||
QString deviceName = audioIO->getActiveAudioDevice(QAudio::AudioOutput).deviceName();
|
QMetaObject::invokeMethod(this, "changeAudioOutputDevice", Qt::QueuedConnection,
|
||||||
QMetaObject::invokeMethod(this, "changeAudioOutputDevice", Qt::QueuedConnection,
|
Q_ARG(QString, _currentAudioOutputDevice), Q_ARG(bool, true));
|
||||||
Q_ARG(QString, deviceName), Q_ARG(bool, true));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::forceQmlAudioOutputDeviceUpdate() {
|
void OffscreenQmlSurface::forceQmlAudioOutputDeviceUpdate() {
|
||||||
if (QThread::currentThread() != qApp->thread()) {
|
if (QThread::currentThread() != qApp->thread()) {
|
||||||
QMetaObject::invokeMethod(this, "forceQmlAudioOutputDeviceUpdate", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "forceQmlAudioOutputDeviceUpdate", Qt::QueuedConnection);
|
||||||
} else {
|
} else {
|
||||||
auto audioIO = DependencyManager::get<AudioClient>();
|
|
||||||
_currentAudioOutputDevice = audioIO->getActiveAudioDevice(QAudio::AudioOutput).deviceName();
|
|
||||||
if (_audioOutputUpdateTimer.isActive()) {
|
if (_audioOutputUpdateTimer.isActive()) {
|
||||||
_audioOutputUpdateTimer.stop();
|
_audioOutputUpdateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue