potential fix for stall

pull/190/head
Ryzerth 2021-07-26 21:30:49 +02:00
rodzic e62351c206
commit 6c05c11a62
1 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -47,6 +47,7 @@ namespace dsp {
void updateWindow(dsp::filter_window::generic_window* window) {
assert(generic_block<HalfDecimator<T>>::_block_init);
std::lock_guard<std::mutex> lck(generic_block<HalfDecimator<T>>::ctrlMtx);
std::lock_guard<std::mutex> lck2(bufMtx);
_window = window;
volk_free(taps);
tapCount = window->getTapCount();
@ -59,7 +60,7 @@ namespace dsp {
int count = _in->read();
if (count < 0) { return -1; }
generic_block<HalfDecimator<T>>::ctrlMtx.lock();
bufMtx.lock();
memcpy(bufStart, _in->readBuf, count * sizeof(T));
_in->flush();
@ -82,11 +83,13 @@ namespace dsp {
}
_inIndex = inIndex - count;
if (!out.swap(outIndex)) { return -1; }
if (!out.swap(outIndex)) {
bufMtx.unlock();
return -1;
}
memmove(buffer, &buffer[count], tapCount * sizeof(T));
generic_block<HalfDecimator<T>>::ctrlMtx.unlock();
return count;
}
@ -97,6 +100,7 @@ namespace dsp {
stream<T>* _in;
dsp::filter_window::generic_window* _window;
std::mutex bufMtx;
T* bufStart;
T* buffer;