mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-03-27 09:45:29 +01:00
potential fix for stall
This commit is contained in:
parent
e62351c206
commit
6c05c11a62
@ -47,6 +47,7 @@ namespace dsp {
|
|||||||
void updateWindow(dsp::filter_window::generic_window* window) {
|
void updateWindow(dsp::filter_window::generic_window* window) {
|
||||||
assert(generic_block<HalfDecimator<T>>::_block_init);
|
assert(generic_block<HalfDecimator<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<HalfDecimator<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<HalfDecimator<T>>::ctrlMtx);
|
||||||
|
std::lock_guard<std::mutex> lck2(bufMtx);
|
||||||
_window = window;
|
_window = window;
|
||||||
volk_free(taps);
|
volk_free(taps);
|
||||||
tapCount = window->getTapCount();
|
tapCount = window->getTapCount();
|
||||||
@ -59,7 +60,7 @@ namespace dsp {
|
|||||||
int count = _in->read();
|
int count = _in->read();
|
||||||
if (count < 0) { return -1; }
|
if (count < 0) { return -1; }
|
||||||
|
|
||||||
generic_block<HalfDecimator<T>>::ctrlMtx.lock();
|
bufMtx.lock();
|
||||||
|
|
||||||
memcpy(bufStart, _in->readBuf, count * sizeof(T));
|
memcpy(bufStart, _in->readBuf, count * sizeof(T));
|
||||||
_in->flush();
|
_in->flush();
|
||||||
@ -82,11 +83,13 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
_inIndex = inIndex - count;
|
_inIndex = inIndex - count;
|
||||||
|
|
||||||
if (!out.swap(outIndex)) { return -1; }
|
if (!out.swap(outIndex)) {
|
||||||
|
bufMtx.unlock();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
memmove(buffer, &buffer[count], tapCount * sizeof(T));
|
memmove(buffer, &buffer[count], tapCount * sizeof(T));
|
||||||
|
|
||||||
generic_block<HalfDecimator<T>>::ctrlMtx.unlock();
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -97,6 +100,7 @@ namespace dsp {
|
|||||||
stream<T>* _in;
|
stream<T>* _in;
|
||||||
|
|
||||||
dsp::filter_window::generic_window* _window;
|
dsp::filter_window::generic_window* _window;
|
||||||
|
std::mutex bufMtx;
|
||||||
|
|
||||||
T* bufStart;
|
T* bufStart;
|
||||||
T* buffer;
|
T* buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user