OSX fixes

This commit is contained in:
Charles J. Cliffe
2014-12-22 23:27:52 -05:00
parent 1dc218d346
commit 703501f32d
4 changed files with 41 additions and 47 deletions
+11 -8
View File
@@ -100,7 +100,7 @@ void DemodulatorPreThread::threadMain() {
std::cout << "Demodulator preprocessor thread started.." << std::endl;
while (!terminated) {
DemodulatorThreadIQData inp;
DemodulatorThreadIQData *inp;
inputQueue->pop(inp);
bool bandwidthChanged = false;
@@ -144,9 +144,9 @@ void DemodulatorPreThread::threadMain() {
}
// Requested frequency is not center, shift it into the center!
if (inp.frequency != params.frequency) {
if ((params.frequency - inp.frequency) != shift_freq) {
shift_freq = params.frequency - inp.frequency;
if (inp->frequency != params.frequency) {
if ((params.frequency - inp->frequency) != shift_freq) {
shift_freq = params.frequency - inp->frequency;
if (abs(shift_freq) <= (int) ((float) (SRATE / 2) * 1.5)) {
nco_crcf_set_frequency(nco_shift, (2.0 * M_PI) * (((float) abs(shift_freq)) / ((float) SRATE)));
}
@@ -157,8 +157,8 @@ void DemodulatorPreThread::threadMain() {
continue;
}
std::vector<signed char> *data = inp.data;
if (data && data->size()) {
std::vector<signed char> *data = &inp->data;
if (data->size()) {
int bufSize = data->size() / 2;
liquid_float_complex in_buf_data[bufSize];
@@ -197,7 +197,10 @@ void DemodulatorPreThread::threadMain() {
resamp.resampler = resampler;
postInputQueue->push(resamp);
inp.cleanup();
inp->decRefCount();
if (inp->getRefCount()<=0) {
delete inp;
}
}
if (!workerResults->empty()) {
@@ -236,7 +239,7 @@ void DemodulatorPreThread::threadMain() {
void DemodulatorPreThread::terminate() {
terminated = true;
DemodulatorThreadIQData inp; // push dummy to nudge queue
DemodulatorThreadIQData *inp = new DemodulatorThreadIQData; // push dummy to nudge queue
inputQueue->push(inp);
workerThread->terminate();
}