1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

Fix race condition that can result in a crash or hang

This commit is contained in:
Jon Beniston 2023-10-22 23:24:34 +01:00
parent 9799874c17
commit 8814fda178
12 changed files with 16 additions and 16 deletions

View File

@ -32,6 +32,7 @@ AISDemodBaseband::AISDemodBaseband(AISDemod *aisDemod) :
{ {
qDebug("AISDemodBaseband::AISDemodBaseband"); qDebug("AISDemodBaseband::AISDemodBaseband");
m_scopeSink.setNbStreams(AISDemodSettings::m_scopeStreams);
m_sink.setScopeSink(&m_scopeSink); m_sink.setScopeSink(&m_scopeSink);
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
m_channelizer = new DownChannelizer(&m_sink); m_channelizer = new DownChannelizer(&m_sink);

View File

@ -744,7 +744,6 @@ AISDemodGUI::AISDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_scopeVis = m_aisDemod->getScopeSink(); m_scopeVis = m_aisDemod->getScopeSink();
m_scopeVis->setGLScope(ui->glScope); m_scopeVis->setGLScope(ui->glScope);
m_scopeVis->setNbStreams(AISDemodSettings::m_scopeStreams);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "FM demod", "Gaussian", "RX buf", "Correlation", "Threshold met", "DC offset", "CRC"})); ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "FM demod", "Gaussian", "RX buf", "Correlation", "Threshold met", "DC offset", "CRC"}));

View File

@ -26,12 +26,13 @@
MESSAGE_CLASS_DEFINITION(DSCDemodBaseband::MsgConfigureDSCDemodBaseband, Message) MESSAGE_CLASS_DEFINITION(DSCDemodBaseband::MsgConfigureDSCDemodBaseband, Message)
DSCDemodBaseband::DSCDemodBaseband(DSCDemod *packetDemod) : DSCDemodBaseband::DSCDemodBaseband(DSCDemod *dscDemod) :
m_sink(packetDemod), m_sink(dscDemod),
m_running(false) m_running(false)
{ {
qDebug("DSCDemodBaseband::DSCDemodBaseband"); qDebug("DSCDemodBaseband::DSCDemodBaseband");
m_scopeSink.setNbStreams(DSCDemodSettings::m_scopeStreams);
m_sink.setScopeSink(&m_scopeSink); m_sink.setScopeSink(&m_scopeSink);
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
m_channelizer = new DownChannelizer(&m_sink); m_channelizer = new DownChannelizer(&m_sink);
@ -92,7 +93,7 @@ void DSCDemodBaseband::handleData()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0)) while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0) && m_channelizer->getBasebandSampleRate())
{ {
SampleVector::iterator part1begin; SampleVector::iterator part1begin;
SampleVector::iterator part1end; SampleVector::iterator part1end;

View File

@ -61,7 +61,7 @@ public:
{ } { }
}; };
DSCDemodBaseband(DSCDemod *packetDemod); DSCDemodBaseband(DSCDemod *dscDemod);
~DSCDemodBaseband(); ~DSCDemodBaseband();
void reset(); void reset();
void startWork(); void startWork();

View File

@ -576,7 +576,6 @@ DSCDemodGUI::DSCDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_scopeVis = m_dscDemod->getScopeSink(); m_scopeVis = m_dscDemod->getScopeSink();
m_scopeVis->setGLScope(ui->glScope); m_scopeVis->setGLScope(ui->glScope);
m_scopeVis->setNbStreams(DSCDemodSettings::m_scopeStreams);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "abs1", "abs2", "Unbiased", "Biased", "Data", "Clock", "Bit", "GotSOP"})); ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "abs1", "abs2", "Unbiased", "Biased", "Data", "Clock", "Bit", "GotSOP"}));

View File

@ -41,7 +41,7 @@ class ScopeVis;
class DSCDemodSink : public ChannelSampleSink { class DSCDemodSink : public ChannelSampleSink {
public: public:
DSCDemodSink(DSCDemod *packetDemod); DSCDemodSink(DSCDemod *dscDemod);
~DSCDemodSink(); ~DSCDemodSink();
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);

View File

@ -26,8 +26,8 @@
MESSAGE_CLASS_DEFINITION(NavtexDemodBaseband::MsgConfigureNavtexDemodBaseband, Message) MESSAGE_CLASS_DEFINITION(NavtexDemodBaseband::MsgConfigureNavtexDemodBaseband, Message)
NavtexDemodBaseband::NavtexDemodBaseband(NavtexDemod *packetDemod) : NavtexDemodBaseband::NavtexDemodBaseband(NavtexDemod *navtexDemod) :
m_sink(packetDemod), m_sink(navtexDemod),
m_running(false) m_running(false)
{ {
qDebug("NavtexDemodBaseband::NavtexDemodBaseband"); qDebug("NavtexDemodBaseband::NavtexDemodBaseband");
@ -92,7 +92,7 @@ void NavtexDemodBaseband::handleData()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0)) while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0) && m_channelizer->getBasebandSampleRate())
{ {
SampleVector::iterator part1begin; SampleVector::iterator part1begin;
SampleVector::iterator part1end; SampleVector::iterator part1end;

View File

@ -61,7 +61,7 @@ public:
{ } { }
}; };
NavtexDemodBaseband(NavtexDemod *packetDemod); NavtexDemodBaseband(NavtexDemod *navtexDemod);
~NavtexDemodBaseband(); ~NavtexDemodBaseband();
void reset(); void reset();
void startWork(); void startWork();

View File

@ -26,8 +26,8 @@
MESSAGE_CLASS_DEFINITION(RttyDemodBaseband::MsgConfigureRttyDemodBaseband, Message) MESSAGE_CLASS_DEFINITION(RttyDemodBaseband::MsgConfigureRttyDemodBaseband, Message)
RttyDemodBaseband::RttyDemodBaseband(RttyDemod *packetDemod) : RttyDemodBaseband::RttyDemodBaseband(RttyDemod *rttyDemod) :
m_sink(packetDemod), m_sink(rttyDemod),
m_running(false) m_running(false)
{ {
qDebug("RttyDemodBaseband::RttyDemodBaseband"); qDebug("RttyDemodBaseband::RttyDemodBaseband");
@ -92,7 +92,7 @@ void RttyDemodBaseband::handleData()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0)) while ((m_sampleFifo.fill() > 0) && (m_inputMessageQueue.size() == 0) && m_channelizer->getBasebandSampleRate())
{ {
SampleVector::iterator part1begin; SampleVector::iterator part1begin;
SampleVector::iterator part1end; SampleVector::iterator part1end;

View File

@ -61,7 +61,7 @@ public:
{ } { }
}; };
RttyDemodBaseband(RttyDemod *packetDemod); RttyDemodBaseband(RttyDemod *rttyDemod);
~RttyDemodBaseband(); ~RttyDemodBaseband();
void reset(); void reset();
void startWork(); void startWork();

View File

@ -33,6 +33,7 @@ RadioClockBaseband::RadioClockBaseband(RadioClock *radioClock) :
{ {
qDebug("RadioClockBaseband::RadioClockBaseband"); qDebug("RadioClockBaseband::RadioClockBaseband");
m_scopeSink.setNbStreams(RadioClockSettings::m_scopeStreams);
m_sink.setScopeSink(&m_scopeSink); m_sink.setScopeSink(&m_scopeSink);
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
m_channelizer = new DownChannelizer(&m_sink); m_channelizer = new DownChannelizer(&m_sink);

View File

@ -292,7 +292,6 @@ RadioClockGUI::RadioClockGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
m_scopeVis = m_radioClock->getScopeSink(); m_scopeVis = m_radioClock->getScopeSink();
m_scopeVis->setGLScope(ui->glScope); m_scopeVis->setGLScope(ui->glScope);
m_scopeVis->setNbStreams(RadioClockSettings::m_scopeStreams);
m_scopeVis->setLiveRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE); m_scopeVis->setLiveRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);