1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Fixed memory leak with handling of DSPSignalNotification message in modulators and demodulators. Removed reference to unused PIDController class

This commit is contained in:
f4exb 2018-02-14 20:11:36 +01:00
parent c0eed06b69
commit 67e664ef06
35 changed files with 154 additions and 80 deletions

View File

@ -25,8 +25,8 @@
#include "dsp/downchannelizer.h"
#include "audio/audiooutput.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
MESSAGE_CLASS_DEFINITION(AMDemod::MsgConfigureAMDemod, Message)
@ -173,6 +173,10 @@ bool AMDemod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -8,7 +8,7 @@
const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = {
QString("AM Demodulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -22,7 +22,6 @@
#include "audio/audiooutput.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "device/devicesourceapi.h"

View File

@ -27,7 +27,7 @@
const PluginDescriptor ATVDemodPlugin::m_ptrPluginDescriptor =
{
QString("ATV Demodulator"),
QString("3.9.0"),
QString("3.12.0"),
QString("(c) F4HKW for F4EXB / SDRAngel"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -22,9 +22,9 @@
#include "audio/audiooutput.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include <dsp/downchannelizer.h>
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "rdsparser.h"
@ -350,6 +350,10 @@ bool BFMDemod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
qDebug() << "BFMDemod::handleMessage: passed: " << cmd.getIdentifier();

View File

@ -25,7 +25,7 @@
const PluginDescriptor BFMPlugin::m_pluginDescriptor = {
QString("Broadcast FM Demodulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -21,13 +21,12 @@
#include <stdio.h>
#include <complex.h>
#include <dsp/downchannelizer.h>
#include "audio/audiooutput.h"
#include "dsp/pidcontroller.h"
#include "dsp/dspengine.h"
#include "dsp/threadedbasebandsamplesink.h"
#include <dsp/downchannelizer.h>
#include <device/devicesourceapi.h>
#include "dsp/downchannelizer.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "dsddemod.h"
@ -365,6 +364,10 @@ bool DSDDemod::handleMessage(const Message& cmd)
m_dsdDecoder.setMyPoint(cfg.getMyLatitude(), cfg.getMyLongitude());
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -25,7 +25,7 @@
const PluginDescriptor DSDDemodPlugin::m_pluginDescriptor = {
QString("DSD Demodulator"),
QString("3.11.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -21,9 +21,10 @@
#include <QDebug>
#include <stdio.h>
#include <dsp/downchannelizer.h>
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include <device/devicesourceapi.h>
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "lorademod.h"
#include "lorabits.h"
@ -347,6 +348,10 @@ bool LoRaDemod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
if(m_sampleSink != 0)

View File

@ -7,7 +7,7 @@
const PluginDescriptor LoRaPlugin::m_pluginDescriptor = {
QString("LoRa Demodulator"),
QString("3.9.0"),
QString("3.12.0"),
QString("(c) 2015 John Greb"),
QString("http://www.maintech.de"),
true,

View File

@ -26,9 +26,9 @@
#include "dsp/downchannelizer.h"
#include "util/stepfunctions.h"
#include "audio/audiooutput.h"
#include "dsp/pidcontroller.h"
#include "dsp/dspengine.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "audio/audionetsink.h"
@ -369,6 +369,10 @@ bool NFMDemod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -7,7 +7,7 @@
const PluginDescriptor NFMPlugin::m_pluginDescriptor = {
QString("NFM Demodulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -23,8 +23,9 @@
#include "audio/audiooutput.h"
#include "dsp/dspengine.h"
#include <dsp/downchannelizer.h>
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "util/db.h"
@ -324,6 +325,10 @@ bool SSBDemod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
if(m_sampleSink != 0)

View File

@ -23,10 +23,10 @@
#include <dsp/downchannelizer.h>
#include "dsp/threadedbasebandsamplesink.h"
#include <device/devicesourceapi.h>
#include "device/devicesourceapi.h"
#include "audio/audiooutput.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/dspcommands.h"
#include "wfmdemod.h"
@ -47,7 +47,6 @@ WFMDemod::WFMDemod(DeviceSourceAPI* deviceAPI) :
m_magsqSum(0.0f),
m_magsqPeak(0.0f),
m_magsqCount(0),
m_sampleSink(0),
m_audioFifo(250000),
m_settingsMutex(QMutex::Recursive)
{
@ -182,11 +181,6 @@ void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
m_audioBufferFill = 0;
}
if(m_sampleSink != 0)
{
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), false);
}
m_sampleBuffer.clear();
m_settingsMutex.unlock();
@ -238,16 +232,13 @@ bool WFMDemod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
if (m_sampleSink != 0)
{
return m_sampleSink->handleMessage(cmd);
}
else
{
return false;
}
return false;
}
}

View File

@ -91,7 +91,6 @@ public:
WFMDemod(DeviceSourceAPI *deviceAPI);
virtual ~WFMDemod();
virtual void destroy() { delete this; }
void setSampleSink(BasebandSampleSink* sampleSink) { m_sampleSink = sampleSink; }
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
virtual void start();
@ -158,7 +157,6 @@ private:
uint m_audioBufferFill;
UDPSink<qint16> *m_udpBufferAudio;
BasebandSampleSink* m_sampleSink;
AudioFifo m_audioFifo;
SampleVector m_sampleBuffer;
QMutex m_settingsMutex;

View File

@ -8,7 +8,7 @@
const PluginDescriptor WFMPlugin::m_pluginDescriptor = {
QString("WFM Demodulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -19,9 +19,10 @@
#include <QTcpServer>
#include <QTcpSocket>
#include <dsp/downchannelizer.h>
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include <device/devicesourceapi.h>
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "tcpsrcgui.h"
@ -305,6 +306,10 @@ bool TCPSrc::handleMessage(const Message& cmd)
processDeconnection();
}
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
if(m_spectrum != 0)

View File

@ -8,7 +8,7 @@
const PluginDescriptor TCPSrcPlugin::m_pluginDescriptor = {
QString("TCP Channel Source"),
QString("3.9.0"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -22,6 +22,7 @@
#include "util/db.h"
#include "dsp/downchannelizer.h"
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "udpsrcgui.h"
@ -371,6 +372,10 @@ bool UDPSrc::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
if(m_spectrum != 0)

View File

@ -25,7 +25,7 @@
const PluginDescriptor UDPSrcPlugin::m_pluginDescriptor = {
QString("UDP Channel Source"),
QString("3.11.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -19,12 +19,14 @@
#include <QTime>
#include <QDebug>
#include <QMutexLocker>
#include <stdio.h>
#include <complex.h>
#include <dsp/upchannelizer.h>
#include "dsp/upchannelizer.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureAMMod, Message)
@ -333,6 +335,10 @@ bool AMMod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -24,7 +24,7 @@
const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
QString("AM Modulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -21,6 +21,7 @@
#include "dsp/upchannelizer.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
#include "atvmod.h"
@ -636,6 +637,10 @@ bool ATVMod::handleMessage(const Message& cmd)
m_showOverlayText = showOverlayText;
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -24,7 +24,7 @@
const PluginDescriptor ATVModPlugin::m_pluginDescriptor = {
QString("ATV Modulator"),
QString("3.9.0"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -25,9 +25,9 @@
#include <complex.h>
#include <algorithm>
#include <dsp/upchannelizer.h>
#include "dsp/upchannelizer.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
#include "dsp/threadedbasebandsamplesource.h"
@ -342,6 +342,10 @@ bool NFMMod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;
@ -503,27 +507,7 @@ int NFMMod::webapiSettingsGet(
QString& errorMessage __attribute__((unused)))
{
response.setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
response.getNfmModSettings()->setAfBandwidth(m_settings.m_afBandwidth);
response.getNfmModSettings()->setAudioSampleRate(m_settings.m_audioSampleRate);
response.getNfmModSettings()->setChannelMute(m_settings.m_channelMute ? 1 : 0);
response.getNfmModSettings()->setCtcssIndex(m_settings.m_ctcssIndex);
response.getNfmModSettings()->setCtcssOn(m_settings.m_ctcssOn ? 1 : 0);
response.getNfmModSettings()->setFmDeviation(m_settings.m_fmDeviation);
response.getNfmModSettings()->setInputFrequencyOffset(m_settings.m_inputFrequencyOffset);
response.getNfmModSettings()->setModAfInput((int) m_settings.m_modAFInput);
response.getNfmModSettings()->setPlayLoop(m_settings.m_playLoop ? 1 : 0);
response.getNfmModSettings()->setRfBandwidth(m_settings.m_rfBandwidth);
response.getNfmModSettings()->setRgbColor(m_settings.m_rgbColor);
*response.getNfmModSettings()->getTitle() = m_settings.m_title;
response.getNfmModSettings()->setToneFrequency(m_settings.m_toneFrequency);
response.getNfmModSettings()->setVolumeFactor(m_settings.m_volumeFactor);
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
webapiFormatChannelSettings(response, m_settings);
return 200;
}
@ -635,5 +619,49 @@ int NFMMod::webapiSettingsPutPatch(
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatChannelSettings(response, settings);
return 200;
}
void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const NFMModSettings& settings)
{
response.getNfmModSettings()->setAfBandwidth(m_settings.m_afBandwidth);
response.getNfmModSettings()->setAudioSampleRate(m_settings.m_audioSampleRate);
response.getNfmModSettings()->setChannelMute(m_settings.m_channelMute ? 1 : 0);
response.getNfmModSettings()->setCtcssIndex(m_settings.m_ctcssIndex);
response.getNfmModSettings()->setCtcssOn(m_settings.m_ctcssOn ? 1 : 0);
response.getNfmModSettings()->setFmDeviation(m_settings.m_fmDeviation);
response.getNfmModSettings()->setInputFrequencyOffset(m_settings.m_inputFrequencyOffset);
response.getNfmModSettings()->setModAfInput((int) m_settings.m_modAFInput);
response.getNfmModSettings()->setPlayLoop(m_settings.m_playLoop ? 1 : 0);
response.getNfmModSettings()->setRfBandwidth(m_settings.m_rfBandwidth);
response.getNfmModSettings()->setRgbColor(m_settings.m_rgbColor);
if (response.getNfmModSettings()->getTitle()) {
*response.getNfmModSettings()->getTitle() = m_settings.m_title;
} else {
response.getNfmModSettings()->setTitle(new QString(settings.m_title));
}
response.getNfmModSettings()->setToneFrequency(m_settings.m_toneFrequency);
response.getNfmModSettings()->setVolumeFactor(m_settings.m_volumeFactor);
if (!response.getNfmModSettings()->getCwKeyer()) {
response.getNfmModSettings()->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings);
}
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
}

View File

@ -310,6 +310,7 @@ private:
void modulateSample();
void openFileStream();
void seekFileStream(int seekPercentage);
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const NFMModSettings& settings);
};

View File

@ -23,7 +23,7 @@
const PluginDescriptor NFMModPlugin::m_pluginDescriptor = {
QString("NFM Modulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -19,12 +19,14 @@
#include <QTime>
#include <QDebug>
#include <QMutexLocker>
#include <stdio.h>
#include <complex.h>
#include <dsp/upchannelizer.h>
#include "dsp/upchannelizer.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
#include "util/db.h"
@ -584,6 +586,10 @@ bool SSBMod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -24,7 +24,7 @@
const PluginDescriptor SSBModPlugin::m_pluginDescriptor = {
QString("SSB Modulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -22,10 +22,10 @@
#include <complex.h>
#include <algorithm>
#include <dsp/upchannelizer.h>
#include "dsp/upchannelizer.h"
#include "dsp/dspengine.h"
#include "dsp/pidcontroller.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
#include "wfmmod.h"
@ -359,6 +359,10 @@ bool WFMMod::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
return false;

View File

@ -24,7 +24,7 @@
const PluginDescriptor WFMModPlugin::m_pluginDescriptor = {
QString("WFM Modulator"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -19,6 +19,7 @@
#include "device/devicesinkapi.h"
#include "dsp/upchannelizer.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/dspcommands.h"
#include "util/db.h"
#include "udpsinkmsg.h"
@ -416,6 +417,10 @@ bool UDPSink::handleMessage(const Message& cmd)
return true;
}
else if (DSPSignalNotification::match(cmd))
{
return true;
}
else
{
if(m_spectrum != 0)

View File

@ -24,7 +24,7 @@
const PluginDescriptor UDPSinkPlugin::m_pluginDescriptor = {
QString("UDP Channel Sink"),
QString("3.10.1"),
QString("3.12.0"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -37,7 +37,6 @@ set(sdrbase_SOURCES
dsp/lowpass.cpp
dsp/nco.cpp
dsp/ncof.cpp
dsp/pidcontroller.cpp
dsp/phaselock.cpp
dsp/samplesinkfifo.cpp
dsp/samplesourcefifo.cpp
@ -138,7 +137,6 @@ set(sdrbase_HEADERS
dsp/ncof.h
dsp/phasediscri.h
dsp/phaselock.h
dsp/pidcontroller.h
dsp/recursivefilters.h
dsp/samplesinkfifo.h
dsp/samplesourcefifo.h

View File

@ -83,7 +83,6 @@ SOURCES += audio/audiodeviceinfo.cpp\
dsp/lowpass.cpp\
dsp/nco.cpp\
dsp/ncof.cpp\
dsp/pidcontroller.cpp\
dsp/phaselock.cpp\
dsp/recursivefilters.cpp\
dsp/samplesinkfifo.cpp\
@ -169,7 +168,6 @@ HEADERS += audio/audiodeviceinfo.h\
dsp/ncof.h\
dsp/phasediscri.h\
dsp/phaselock.h\
dsp/pidcontroller.h\
dsp/recursivefilters.h\
dsp/samplesinkfifo.h\
dsp/samplesourcefifo.h\