mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-27 06:08:37 -05:00
Make sure n_read is > 0 ..
This commit is contained in:
parent
7f2f3d95d2
commit
d551d5f2c4
@ -276,21 +276,22 @@ void SDRThread::run() {
|
|||||||
|
|
||||||
// std::cout << n_read << ", " << timeNs << std::endl;
|
// std::cout << n_read << ", " << timeNs << std::endl;
|
||||||
|
|
||||||
SDRThreadIQData *dataOut = buffers.getBuffer();
|
if (n_read > 0) {
|
||||||
|
SDRThreadIQData *dataOut = buffers.getBuffer();
|
||||||
dataOut->setRefCount(1);
|
|
||||||
dataOut->frequency = frequency;
|
dataOut->setRefCount(1);
|
||||||
dataOut->sampleRate = sampleRate.load();
|
dataOut->frequency = frequency;
|
||||||
|
dataOut->sampleRate = sampleRate.load();
|
||||||
dataOut->data.resize(n_read * 2);
|
|
||||||
memcpy(&dataOut->data[0],buffs[0],n_read * sizeof(float) * 2);
|
dataOut->data.resize(n_read * 2);
|
||||||
|
memcpy(&dataOut->data[0],buffs[0],n_read * sizeof(float) * 2);
|
||||||
if (iqDataOutQueue != NULL) {
|
|
||||||
iqDataOutQueue->push(dataOut);
|
if (iqDataOutQueue != NULL) {
|
||||||
} else {
|
iqDataOutQueue->push(dataOut);
|
||||||
dataOut->setRefCount(0);
|
} else {
|
||||||
|
dataOut->setRefCount(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
device->deactivateStream(stream);
|
device->deactivateStream(stream);
|
||||||
device->closeStream(stream);
|
device->closeStream(stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user