mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-28 08:16:37 -04:00
Static analysis related fixes
This commit is contained in:
parent
e0df7cb41d
commit
f22ef685f5
@ -1610,7 +1610,7 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
|
|
||||||
DataNode *demodTypeNode = demod->hasAnother("type")?demod->getNext("type"):nullptr;
|
DataNode *demodTypeNode = demod->hasAnother("type")?demod->getNext("type"):nullptr;
|
||||||
|
|
||||||
if (demodTypeNode->element()->getDataType() == DATA_INT) {
|
if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_INT) {
|
||||||
int legacyType = *demodTypeNode;
|
int legacyType = *demodTypeNode;
|
||||||
int legacyStereo = demod->hasAnother("stereo") ? (int) *demod->getNext("stereo") : 0;
|
int legacyStereo = demod->hasAnother("stereo") ? (int) *demod->getNext("stereo") : 0;
|
||||||
switch (legacyType) { // legacy demod ID
|
switch (legacyType) { // legacy demod ID
|
||||||
@ -1632,7 +1632,7 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
case 16: type = "I/Q"; break;
|
case 16: type = "I/Q"; break;
|
||||||
default: type = "FM"; break;
|
default: type = "FM"; break;
|
||||||
}
|
}
|
||||||
} else if (demodTypeNode->element()->getDataType() == DATA_STRING) {
|
} else if (demodTypeNode && demodTypeNode->element()->getDataType() == DATA_STRING) {
|
||||||
demodTypeNode->element()->get(type);
|
demodTypeNode->element()->get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,11 +20,13 @@ AudioThread::AudioThread() : IOThread(),
|
|||||||
outputDevice.store(-1);
|
outputDevice.store(-1);
|
||||||
gain.store(1.0);
|
gain.store(1.0);
|
||||||
|
|
||||||
boundThreads.store(new std::vector<AudioThread *>);
|
vBoundThreads = new std::vector<AudioThread *>;
|
||||||
|
boundThreads.store(vBoundThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioThread::~AudioThread() {
|
AudioThread::~AudioThread() {
|
||||||
delete boundThreads.load();
|
boundThreads.store(nullptr);
|
||||||
|
delete vBoundThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioThread::bindThread(AudioThread *other) {
|
void AudioThread::bindThread(AudioThread *other) {
|
||||||
|
@ -100,5 +100,6 @@ public:
|
|||||||
static void deviceCleanup();
|
static void deviceCleanup();
|
||||||
static void setDeviceSampleRate(int deviceId, int sampleRate);
|
static void setDeviceSampleRate(int deviceId, int sampleRate);
|
||||||
std::atomic<std::vector<AudioThread *> *> boundThreads;
|
std::atomic<std::vector<AudioThread *> *> boundThreads;
|
||||||
|
std::vector<AudioThread *> *vBoundThreads;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,17 +137,23 @@ bool DemodulatorInstance::isTerminated() {
|
|||||||
|
|
||||||
switch (cmd.cmd) {
|
switch (cmd.cmd) {
|
||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
||||||
t_Audio->join();
|
if (t_Audio) {
|
||||||
audioTerminated = true;
|
t_Audio->join();
|
||||||
delete t_Audio;
|
audioTerminated = true;
|
||||||
|
delete t_Audio;
|
||||||
|
t_Audio = nullptr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
||||||
#ifdef __APPLE__
|
if (t_Demod) {
|
||||||
pthread_join(t_Demod, NULL);
|
#ifdef __APPLE__
|
||||||
#else
|
pthread_join(t_Demod, nullptr);
|
||||||
t_Demod->join();
|
#else
|
||||||
delete t_Demod;
|
t_Demod->join();
|
||||||
#endif
|
delete t_Demod;
|
||||||
|
#endif
|
||||||
|
t_Demod = nullptr;
|
||||||
|
}
|
||||||
#if ENABLE_DIGITAL_LAB
|
#if ENABLE_DIGITAL_LAB
|
||||||
if (activeOutput) {
|
if (activeOutput) {
|
||||||
closeOutput();
|
closeOutput();
|
||||||
@ -156,13 +162,16 @@ bool DemodulatorInstance::isTerminated() {
|
|||||||
demodTerminated = true;
|
demodTerminated = true;
|
||||||
break;
|
break;
|
||||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED:
|
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED:
|
||||||
#ifdef __APPLE__
|
if (t_PreDemod) {
|
||||||
pthread_join(t_PreDemod, NULL);
|
#ifdef __APPLE__
|
||||||
#else
|
pthread_join(t_PreDemod, NULL);
|
||||||
t_PreDemod->join();
|
#else
|
||||||
delete t_PreDemod;
|
t_PreDemod->join();
|
||||||
#endif
|
delete t_PreDemod;
|
||||||
preDemodTerminated = true;
|
#endif
|
||||||
|
preDemodTerminated = true;
|
||||||
|
t_PreDemod = nullptr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -84,7 +84,7 @@ void DemodulatorWorkerThread::run() {
|
|||||||
|
|
||||||
float As = 60.0f; // stop-band attenuation [dB]
|
float As = 60.0f; // stop-band attenuation [dB]
|
||||||
|
|
||||||
if (result.sampleRate && result.bandwidth) {
|
if (cModem && result.sampleRate && result.bandwidth) {
|
||||||
result.bandwidth = cModem->checkSampleRate(result.bandwidth, makeDemod?demodCommand.audioSampleRate:filterCommand.audioSampleRate);
|
result.bandwidth = cModem->checkSampleRate(result.bandwidth, makeDemod?demodCommand.audioSampleRate:filterCommand.audioSampleRate);
|
||||||
result.iqResampleRatio = (double) (result.bandwidth) / (double) result.sampleRate;
|
result.iqResampleRatio = (double) (result.bandwidth) / (double) result.sampleRate;
|
||||||
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);
|
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);
|
||||||
|
@ -184,7 +184,9 @@ void SDRPostThread::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data_in->decRefCount();
|
if (data_in) {
|
||||||
|
data_in->decRefCount();
|
||||||
|
}
|
||||||
|
|
||||||
bool doUpdate = false;
|
bool doUpdate = false;
|
||||||
for (size_t j = 0; j < nRunDemods; j++) {
|
for (size_t j = 0; j < nRunDemods; j++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user