1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-07 00:14:49 -04:00

All device plugins: make sure start and stop are effective once only. PArt of #2159

This commit is contained in:
f4exb
2024-08-21 05:27:01 +02:00
committed by Edouard Griffiths
parent 1b37a4f504
commit 585d806ef8
40 changed files with 454 additions and 243 deletions
+16 -11
View File
@@ -149,15 +149,17 @@ bool SDRPlayInput::openDevice()
bool SDRPlayInput::start()
{
// QMutexLocker mutexLocker(&m_mutex);
int res;
QMutexLocker mutexLocker(&m_mutex);
if (m_running) {
return true;
}
if (!m_dev) {
return false;
}
if (m_running) stop();
int res;
char s12FormatString[] = "336_S16";
if ((res = mirisdr_set_sample_format(m_dev, s12FormatString))) // sample format S12
@@ -197,12 +199,11 @@ bool SDRPlayInput::start()
m_sdrPlayThread->setFcPos((int) m_settings.m_fcPos);
m_sdrPlayThread->setIQOrder(m_settings.m_iqOrder);
m_sdrPlayThread->startWork();
// mutexLocker.unlock();
applySettings(m_settings, QList<QString>(), true, true);
m_running = true;
mutexLocker.unlock();
applySettings(m_settings, QList<QString>(), true, true);
return true;
}
@@ -224,7 +225,13 @@ void SDRPlayInput::init()
void SDRPlayInput::stop()
{
// QMutexLocker mutexLocker(&m_mutex);
QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
m_running = false;
if(m_sdrPlayThread)
{
@@ -232,8 +239,6 @@ void SDRPlayInput::stop()
delete m_sdrPlayThread;
m_sdrPlayThread = nullptr;
}
m_running = false;
}
QByteArray SDRPlayInput::serialize() const