mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-07-12 22:04:05 -04:00
Threading crash fixes, reusable IQ buffer queue
This commit is contained in:
@@ -157,6 +157,7 @@ void DemodulatorPreThread::threadMain() {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::lock_guard < std::mutex > lock(inp->m_mutex);
|
||||
std::vector<signed char> *data = &inp->data;
|
||||
if (data->size()) {
|
||||
int bufSize = data->size() / 2;
|
||||
@@ -173,6 +174,8 @@ void DemodulatorPreThread::threadMain() {
|
||||
in_buf[i].imag = (float) (*data)[i * 2 + 1] / 127.0f;
|
||||
}
|
||||
|
||||
inp->decRefCount();
|
||||
|
||||
if (shift_freq != 0) {
|
||||
if (shift_freq < 0) {
|
||||
nco_crcf_mix_block_up(nco_shift, in_buf, out_buf, bufSize);
|
||||
@@ -195,10 +198,8 @@ void DemodulatorPreThread::threadMain() {
|
||||
resamp->resampler = resampler;
|
||||
|
||||
postInputQueue->push(resamp);
|
||||
} else {
|
||||
inp->decRefCount();
|
||||
if (inp->getRefCount()<=0) {
|
||||
delete inp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!workerResults->empty()) {
|
||||
|
||||
Reference in New Issue
Block a user