mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 20:28:40 -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->setRefCount(1);
|
||||||
dataOut->frequency = frequency;
|
dataOut->frequency = frequency;
|
||||||
dataOut->sampleRate = sampleRate.load();
|
dataOut->sampleRate = sampleRate.load();
|
||||||
|
|
||||||
dataOut->data.resize(n_read * 2);
|
dataOut->data.resize(n_read * 2);
|
||||||
memcpy(&dataOut->data[0],buffs[0],n_read * sizeof(float) * 2);
|
memcpy(&dataOut->data[0],buffs[0],n_read * sizeof(float) * 2);
|
||||||
|
|
||||||
if (iqDataOutQueue != NULL) {
|
if (iqDataOutQueue != NULL) {
|
||||||
iqDataOutQueue->push(dataOut);
|
iqDataOutQueue->push(dataOut);
|
||||||
} else {
|
} else {
|
||||||
dataOut->setRefCount(0);
|
dataOut->setRefCount(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
device->deactivateStream(stream);
|
device->deactivateStream(stream);
|
||||||
device->closeStream(stream);
|
device->closeStream(stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user