Fix for an initial priming overload and visuals memory leak

This commit is contained in:
Charles J. Cliffe 2015-08-12 21:45:02 -04:00
parent 9de7bc95fb
commit 1d5a2f1ac7
4 changed files with 17 additions and 4 deletions

View File

@ -78,9 +78,11 @@ bool CubicSDR::OnInit() {
scopeProcessor.setInput(pipeAudioVisualData);
// I/Q Data
pipeSDRIQData = new SDRThreadIQDataQueue;
pipeSDRIQData = new SDRThreadIQDataQueue();
pipeSDRCommand = new SDRThreadCommandQueue();
pipeSDRIQData->set_max_num_items(1);
sdrThread = new SDRThread();
sdrThread->setInputQueue("SDRCommandQueue",pipeSDRCommand);
sdrThread->setOutputQueue("IQDataOutput",pipeSDRIQData);

View File

@ -5,6 +5,7 @@
#include <deque>
#include <map>
#include <string>
#include <iostream>
#include "ThreadQueue.h"
@ -63,6 +64,10 @@ public:
return buf;
}
// if (outputBuffers.size() > 100) {
// std::cout << "Buffer over 100.." << std::endl;
// }
buf = new BufferType();
outputBuffers.push_back(buf);

View File

@ -94,7 +94,7 @@ void DemodulatorThread::run() {
while (!terminated) {
DemodulatorThreadPostIQData *inp;
iqInputQueue->pop(inp);
std::lock_guard < std::mutex > lock(inp->m_mutex);
// std::lock_guard < std::mutex > lock(inp->m_mutex);
int bufSize = inp->data.size();

View File

@ -86,6 +86,8 @@ void SDRPostThread::run() {
std::vector<liquid_float_complex> fpData;
std::vector<liquid_float_complex> dataOut;
iqDataInQueue->set_max_num_items(30);
while (!terminated) {
SDRThreadIQData *data_in;
@ -203,8 +205,12 @@ void SDRPostThread::run() {
}
if (iqDataOutQueue != NULL) {
iqDataOutQueue->push(demodDataOut);
pushedData = true;
if (!iqDataOutQueue->full()) {
iqDataOutQueue->push(demodDataOut);
pushedData = true;
} else {
demodDataOut->decRefCount();
}
}
if (!pushedData && iqDataOutQueue == NULL) {