1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Fixed possible sample device pointer not set yet when DSPMIMOSignalNotification message arrives. Fixes #1529

This commit is contained in:
f4exb 2022-12-28 18:55:06 +01:00
parent b387de17bc
commit 12deb59bf4
3 changed files with 78 additions and 79 deletions

View File

@ -1186,69 +1186,72 @@ void DSPDeviceMIMOEngine::handleInputMessages()
(*it)->pushMessage(message);
}
if (sourceElseSink)
if (m_deviceSampleMIMO)
{
if ((istream < m_deviceSampleMIMO->getNbSourceStreams()))
if (sourceElseSink)
{
// forward source changes to ancillary sinks
if (istream < m_basebandSampleSinks.size())
if ((istream < m_deviceSampleMIMO->getNbSourceStreams()))
{
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks[istream].begin(); it != m_basebandSampleSinks[istream].end(); ++it)
// forward source changes to ancillary sinks
if (istream < m_basebandSampleSinks.size())
{
DSPSignalNotification *message = new DSPSignalNotification(sampleRate, centerFrequency);
qDebug() << "DSPDeviceMIMOEngine::handleInputMessages: starting " << (*it)->getSinkName().toStdString().c_str();
(*it)->pushMessage(message);
for (BasebandSampleSinks::const_iterator it = m_basebandSampleSinks[istream].begin(); it != m_basebandSampleSinks[istream].end(); ++it)
{
DSPSignalNotification *message = new DSPSignalNotification(sampleRate, centerFrequency);
qDebug() << "DSPDeviceMIMOEngine::handleInputMessages: starting " << (*it)->getSinkName().toStdString().c_str();
(*it)->pushMessage(message);
}
}
}
// forward changes to MIMO GUI input queue
MessageQueue *guiMessageQueue = m_deviceSampleMIMO->getMessageQueueToGUI();
qDebug("DeviceMIMOEngine::handleInputMessages: DSPMIMOSignalNotification: guiMessageQueue: %p", guiMessageQueue);
// forward changes to MIMO GUI input queue
MessageQueue *guiMessageQueue = m_deviceSampleMIMO->getMessageQueueToGUI();
qDebug("DeviceMIMOEngine::handleInputMessages: DSPMIMOSignalNotification: guiMessageQueue: %p", guiMessageQueue);
if (guiMessageQueue) {
DSPMIMOSignalNotification* rep = new DSPMIMOSignalNotification(*notif); // make a copy for the MIMO GUI
guiMessageQueue->push(rep);
}
if (guiMessageQueue) {
DSPMIMOSignalNotification* rep = new DSPMIMOSignalNotification(*notif); // make a copy for the MIMO GUI
guiMessageQueue->push(rep);
}
// forward changes to spectrum sink if currently active
if (m_spectrumSink && m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream))
{
DSPSignalNotification *spectrumNotif = new DSPSignalNotification(sampleRate, centerFrequency);
m_spectrumSink->pushMessage(spectrumNotif);
// forward changes to spectrum sink if currently active
if (m_spectrumSink && m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream))
{
DSPSignalNotification *spectrumNotif = new DSPSignalNotification(sampleRate, centerFrequency);
m_spectrumSink->pushMessage(spectrumNotif);
}
}
}
}
else
{
if ((istream < m_deviceSampleMIMO->getNbSinkStreams()))
else
{
// forward source changes to channel sources with immediate execution (no queuing)
if (istream < m_basebandSampleSources.size())
if ((istream < m_deviceSampleMIMO->getNbSinkStreams()))
{
for (BasebandSampleSources::const_iterator it = m_basebandSampleSources[istream].begin(); it != m_basebandSampleSources[istream].end(); ++it)
// forward source changes to channel sources with immediate execution (no queuing)
if (istream < m_basebandSampleSources.size())
{
DSPSignalNotification *message = new DSPSignalNotification(sampleRate, centerFrequency);
qDebug() << "DSPDeviceMIMOEngine::handleSinkMessages: forward message to BasebandSampleSource(" << (*it)->getSourceName().toStdString().c_str() << ")";
(*it)->pushMessage(message);
for (BasebandSampleSources::const_iterator it = m_basebandSampleSources[istream].begin(); it != m_basebandSampleSources[istream].end(); ++it)
{
DSPSignalNotification *message = new DSPSignalNotification(sampleRate, centerFrequency);
qDebug() << "DSPDeviceMIMOEngine::handleSinkMessages: forward message to BasebandSampleSource(" << (*it)->getSourceName().toStdString().c_str() << ")";
(*it)->pushMessage(message);
}
}
}
// forward changes to MIMO GUI input queue
MessageQueue *guiMessageQueue = m_deviceSampleMIMO->getMessageQueueToGUI();
qDebug("DSPDeviceMIMOEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
// forward changes to MIMO GUI input queue
MessageQueue *guiMessageQueue = m_deviceSampleMIMO->getMessageQueueToGUI();
qDebug("DSPDeviceMIMOEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
if (guiMessageQueue) {
DSPMIMOSignalNotification* rep = new DSPMIMOSignalNotification(*notif); // make a copy for the source GUI
guiMessageQueue->push(rep);
}
if (guiMessageQueue) {
DSPMIMOSignalNotification* rep = new DSPMIMOSignalNotification(*notif); // make a copy for the source GUI
guiMessageQueue->push(rep);
}
// forward changes to spectrum sink if currently active
if (m_spectrumSink && !m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream))
{
DSPSignalNotification *spectrumNotif = new DSPSignalNotification(sampleRate, centerFrequency);
m_spectrumSink->pushMessage(spectrumNotif);
// forward changes to spectrum sink if currently active
if (m_spectrumSink && !m_spectrumInputSourceElseSink && (m_spectrumInputIndex == istream))
{
DSPSignalNotification *spectrumNotif = new DSPSignalNotification(sampleRate, centerFrequency);
m_spectrumSink->pushMessage(spectrumNotif);
}
}
}
}

View File

@ -267,8 +267,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoIdle()
break;
}
if(m_deviceSampleSink == 0)
{
if (!m_deviceSampleSink) {
return StIdle;
}
@ -304,8 +303,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoInit()
break;
}
if (m_deviceSampleSink == 0)
{
if (!m_deviceSampleSink) {
return gotoError("DSPDeviceSinkEngine::gotoInit: No sample source configured");
}
@ -362,7 +360,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
break;
}
if(m_deviceSampleSink == 0) {
if (!m_deviceSampleSink) {
return gotoError("DSPDeviceSinkEngine::gotoRunning: No sample source configured");
}
@ -370,8 +368,7 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning()
// Start everything
if(!m_deviceSampleSink->start())
{
if (!m_deviceSampleSink->start()) {
return gotoError("DSPDeviceSinkEngine::gotoRunning: Could not start sample sink");
}
@ -533,15 +530,17 @@ void DSPDeviceSinkEngine::handleInputMessages()
}
// forward changes to listeners on DSP output queue
if (m_deviceSampleSink)
{
MessageQueue *guiMessageQueue = m_deviceSampleSink->getMessageQueueToGUI();
qDebug("DSPDeviceSinkEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
MessageQueue *guiMessageQueue = m_deviceSampleSink->getMessageQueueToGUI();
qDebug("DSPDeviceSinkEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
if (guiMessageQueue)
{
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
guiMessageQueue->push(rep);
}
if (guiMessageQueue)
{
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
guiMessageQueue->push(rep);
}
}
delete message;
}

View File

@ -392,8 +392,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoIdle()
break;
}
if(m_deviceSampleSource == 0)
{
if (!m_deviceSampleSource) {
return StIdle;
}
@ -428,8 +427,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoInit()
break;
}
if (m_deviceSampleSource == 0)
{
if (!m_deviceSampleSource) {
return gotoError("No sample source configured");
}
@ -487,7 +485,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
break;
}
if(m_deviceSampleSource == NULL) {
if (!m_deviceSampleSource) {
return gotoError("DSPDeviceSourceEngine::gotoRunning: No sample source configured");
}
@ -495,8 +493,7 @@ DSPDeviceSourceEngine::State DSPDeviceSourceEngine::gotoRunning()
// Start everything
if(!m_deviceSampleSource->start())
{
if (!m_deviceSampleSource->start()) {
return gotoError("Could not start sample source");
}
@ -532,7 +529,7 @@ void DSPDeviceSourceEngine::handleSetSource(DeviceSampleSource* source)
m_deviceSampleSource = source;
if(m_deviceSampleSource != 0)
if (m_deviceSampleSource)
{
qDebug("DSPDeviceSourceEngine::handleSetSource: set %s", qPrintable(source->getDeviceDescription()));
connect(m_deviceSampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()), Qt::QueuedConnection);
@ -673,17 +670,17 @@ void DSPDeviceSourceEngine::handleInputMessages()
}
// forward changes to source GUI input queue
if (m_deviceSampleSource)
{
MessageQueue *guiMessageQueue = m_deviceSampleSource->getMessageQueueToGUI();
qDebug("DSPDeviceSourceEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
MessageQueue *guiMessageQueue = m_deviceSampleSource->getMessageQueueToGUI();
qDebug("DSPDeviceSourceEngine::handleInputMessages: DSPSignalNotification: guiMessageQueue: %p", guiMessageQueue);
if (guiMessageQueue)
{
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the source GUI
guiMessageQueue->push(rep);
}
//m_outputMessageQueue.push(rep);
if (guiMessageQueue)
{
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the source GUI
guiMessageQueue->push(rep);
}
}
delete message;
}