mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 11:49:38 -05:00
Demod worker lock-on-remove fix
This commit is contained in:
parent
d45d3842bf
commit
b2e8cf0482
@ -185,6 +185,7 @@ void CubicSDR::removeDemodulator(DemodulatorInstance *demod) {
|
||||
if (!demod) {
|
||||
return;
|
||||
}
|
||||
demod->setActive(false);
|
||||
sdrPostThread->removeDemodulator(demod);
|
||||
}
|
||||
|
||||
|
@ -126,14 +126,14 @@ bool DemodulatorInstance::isTerminated() {
|
||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
|
||||
t_Audio->join();
|
||||
audioTerminated = true;
|
||||
// delete t_Audio;
|
||||
delete t_Audio;
|
||||
break;
|
||||
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
|
||||
#ifdef __APPLE__
|
||||
pthread_join(t_Demod, NULL);
|
||||
#else
|
||||
t_Demod->join();
|
||||
// delete t_Demod;
|
||||
delete t_Demod;
|
||||
#endif
|
||||
demodTerminated = true;
|
||||
break;
|
||||
@ -142,7 +142,7 @@ bool DemodulatorInstance::isTerminated() {
|
||||
pthread_join(t_PreDemod, NULL);
|
||||
#else
|
||||
t_PreDemod->join();
|
||||
// delete t_PreDemod;
|
||||
delete t_PreDemod;
|
||||
#endif
|
||||
preDemodTerminated = true;
|
||||
break;
|
||||
|
@ -409,6 +409,10 @@ void DemodulatorThread::threadMain() {
|
||||
delete audioDataDel;
|
||||
}
|
||||
|
||||
if (audioVisOutputQueue && !audioVisOutputQueue->empty()) {
|
||||
AudioThreadInput *dummy_vis;
|
||||
audioVisOutputQueue->pop(dummy_vis);
|
||||
}
|
||||
delete ati_vis;
|
||||
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED);
|
||||
|
@ -24,6 +24,9 @@ void DemodulatorWorkerThread::threadMain() {
|
||||
commandQueue->pop(command);
|
||||
switch (command.cmd) {
|
||||
case DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS:
|
||||
if (!filterCommand.bandwidth || !filterCommand.audioSampleRate) {
|
||||
break;
|
||||
}
|
||||
filterChanged = true;
|
||||
filterCommand = command;
|
||||
break;
|
||||
@ -32,13 +35,14 @@ void DemodulatorWorkerThread::threadMain() {
|
||||
}
|
||||
done = commandQueue->empty();
|
||||
}
|
||||
|
||||
|
||||
if (filterChanged && !terminated) {
|
||||
DemodulatorWorkerThreadResult result(DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS);
|
||||
|
||||
result.iqResampleRatio = (double) (filterCommand.bandwidth) / (double) filterCommand.sampleRate;
|
||||
result.audioResamplerRatio = (double) (filterCommand.audioSampleRate) / (double) filterCommand.bandwidth;
|
||||
|
||||
|
||||
float As = 60.0f; // stop-band attenuation [dB]
|
||||
|
||||
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);
|
||||
|
@ -208,6 +208,10 @@ void SDRPostThread::threadMain() {
|
||||
// std::lock_guard < std::mutex > lock(demodDataDel->m_mutex);
|
||||
// delete demodDataDel;
|
||||
}
|
||||
if (iqVisualQueue.load() && !iqVisualQueue.load()->empty()) {
|
||||
DemodulatorThreadIQData *visualDataDummy;
|
||||
iqVisualQueue.load()->pop(visualDataDummy);
|
||||
}
|
||||
|
||||
delete visualDataOut;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user