mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-05 07:24:47 -04:00
Make ReBuffer refcount management automatic, using std::shared_ptr:
- No longer need to call setRefCount() / decRefCount() - Restore old ThreadBlockingQueue using std::deque, for std::shared_ptr correct behaviour.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "AudioThread.h"
|
||||
#include <cmath>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
#define MIN_BANDWIDTH 500
|
||||
|
||||
@@ -25,7 +26,7 @@ public:
|
||||
int audioSampleRate;
|
||||
};
|
||||
|
||||
class ModemIQData: public ReferenceCounter {
|
||||
class ModemIQData {
|
||||
public:
|
||||
std::vector<liquid_float_complex> data;
|
||||
long long sampleRate;
|
||||
@@ -34,11 +35,13 @@ public:
|
||||
|
||||
}
|
||||
|
||||
~ModemIQData() {
|
||||
std::lock_guard < std::recursive_mutex > lock(m_mutex);
|
||||
virtual ~ModemIQData() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<ModemIQData> ModemIQDataPtr;
|
||||
|
||||
// Copy of SoapySDR::Range, original comments
|
||||
class ModemRange
|
||||
{
|
||||
|
||||
@@ -24,13 +24,13 @@ int ModemAM::getDefaultSampleRate() {
|
||||
return 6000;
|
||||
}
|
||||
|
||||
void ModemAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *audioOut) {
|
||||
void ModemAM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput* audioOut) {
|
||||
ModemKitAnalog *amkit = (ModemKitAnalog *)kit;
|
||||
|
||||
initOutputBuffers(amkit,input);
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ void ModemDSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *a
|
||||
initOutputBuffers(amkit, input);
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void ModemFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *au
|
||||
initOutputBuffers(fmkit, input);
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ void ModemIQ::demodulate(ModemKit * /* kit */, ModemIQData *input, AudioThreadIn
|
||||
size_t bufSize = input->data.size();
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void ModemLSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *a
|
||||
initOutputBuffers(akit,input);
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void ModemNBFM::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *
|
||||
initOutputBuffers(fmkit, input);
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void ModemUSB::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *a
|
||||
initOutputBuffers(akit,input);
|
||||
|
||||
if (!bufSize) {
|
||||
input->decRefCount();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user