From 10a64c0330d6a03ac57549b9401eb992eddc151d Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 12 Oct 2019 18:50:42 +0200 Subject: [PATCH] [AFV] Ref T730, do NOT stop audio when disconnecting from FSD * only disconnect from AFV server * keep position tmer alive (preset values) --- src/blackcore/afv/clients/afvclient.cpp | 15 ++++++++++++--- src/blackcore/context/contextaudio.cpp | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/blackcore/afv/clients/afvclient.cpp b/src/blackcore/afv/clients/afvclient.cpp index 161ced89a..ec8a42b09 100644 --- a/src/blackcore/afv/clients/afvclient.cpp +++ b/src/blackcore/afv/clients/afvclient.cpp @@ -128,8 +128,16 @@ namespace BlackCore this->onPositionUpdateTimer(); - if (m_connection->isConnected()) { emit this->connectionStatusChanged(Connected); } - else { emit this->connectionStatusChanged(Disconnected); } + if (m_connection->isConnected()) + { + // restart timer, normally it should be started already, paranoia + if (m_voiceServerPositionTimer) { m_voiceServerPositionTimer->start(PositionUpdatesMs); } + emit this->connectionStatusChanged(Connected); + } + else + { + emit this->connectionStatusChanged(Disconnected); + } } void CAfvClient::disconnectFrom() @@ -142,6 +150,7 @@ namespace BlackCore return; } + // we intentionally DO NOT STOP the timer here, but keep it for preset (own aircraft pos.) m_connection->disconnectFrom(); emit connectionStatusChanged(Disconnected); } @@ -219,7 +228,7 @@ namespace BlackCore m_startDateTimeUtc = QDateTime::currentDateTimeUtc(); m_connection->setReceiveAudio(true); - m_voiceServerPositionTimer->start(PositionUpdatesMs); + m_voiceServerPositionTimer->start(PositionUpdatesMs); // start for preset values this->onSettingsChanged(); // make sure all settings are applied m_isStarted = true; diff --git a/src/blackcore/context/contextaudio.cpp b/src/blackcore/context/contextaudio.cpp index 3efbd1a8f..40c364f02 100644 --- a/src/blackcore/context/contextaudio.cpp +++ b/src/blackcore/context/contextaudio.cpp @@ -417,6 +417,7 @@ namespace BlackCore Q_UNUSED(from) BLACK_VERIFY_X(this->getIContextNetwork(), Q_FUNC_INFO, "Missing network context"); + // we only change network connection of AFC client here if (to.isConnected() && this->getIContextNetwork()) { const CVoiceSetup vs = m_voiceSettings.getThreadLocal(); @@ -427,7 +428,6 @@ namespace BlackCore } else if (to.isDisconnected()) { - m_voiceClient->stopAudio(); m_voiceClient->disconnectFrom(); } }