mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
[AFV] Check client started in the correct thread
This commit is contained in:
@@ -182,18 +182,12 @@ namespace BlackCore
|
|||||||
QMetaObject::invokeMethod(this, [ = ]() { if (myself) restartWithNewDevices(inputDevice, outputDevice); });
|
QMetaObject::invokeMethod(this, [ = ]() { if (myself) restartWithNewDevices(inputDevice, outputDevice); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_isStarted) { this->stopAudio(); }
|
this->stopAudio();
|
||||||
this->startAudio(inputDevice, outputDevice, allTransceiverIds());
|
this->startAudio(inputDevice, outputDevice, allTransceiverIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAfvClient::startAudio(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice, const QVector<quint16> &transceiverIDs)
|
void CAfvClient::startAudio(const CAudioDeviceInfo &inputDevice, const CAudioDeviceInfo &outputDevice, const QVector<quint16> &transceiverIDs)
|
||||||
{
|
{
|
||||||
if (m_isStarted)
|
|
||||||
{
|
|
||||||
CLogMessage(this).info(u"Client already started");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QThread::currentThread() != this->thread())
|
if (QThread::currentThread() != this->thread())
|
||||||
{
|
{
|
||||||
// Method needs to be executed in the object thread since it will create new QObject children
|
// Method needs to be executed in the object thread since it will create new QObject children
|
||||||
@@ -201,6 +195,12 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_isStarted)
|
||||||
|
{
|
||||||
|
CLogMessage(this).info(u"Client already started");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->initTransceivers();
|
this->initTransceivers();
|
||||||
|
|
||||||
if (m_soundcardSampleProvider) { m_soundcardSampleProvider->deleteLater(); }
|
if (m_soundcardSampleProvider) { m_soundcardSampleProvider->deleteLater(); }
|
||||||
@@ -233,12 +233,6 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CAfvClient::stopAudio()
|
void CAfvClient::stopAudio()
|
||||||
{
|
{
|
||||||
if (!m_isStarted)
|
|
||||||
{
|
|
||||||
CLogMessage(this).info(u"Client NOT started");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QThread::currentThread() != this->thread())
|
if (QThread::currentThread() != this->thread())
|
||||||
{
|
{
|
||||||
// Method needs to be executed in the object thread since it will create new QObject children
|
// Method needs to be executed in the object thread since it will create new QObject children
|
||||||
@@ -247,6 +241,12 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_isStarted)
|
||||||
|
{
|
||||||
|
CLogMessage(this).info(u"Client NOT started");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_isStarted = false;
|
m_isStarted = false;
|
||||||
m_connection->setReceiveAudio(false);
|
m_connection->setReceiveAudio(false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user