diff --git a/samplebuffer.cpp b/samplebuffer.cpp index 6965ff7..95e6592 100644 --- a/samplebuffer.cpp +++ b/samplebuffer.cpp @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include "samplebuffer.h" template @@ -39,6 +40,7 @@ std::unique_ptr SampleBuffer::getSamples(off_t start, off_t l return nullptr; std::unique_ptr dest(new Tout[length]); + QMutexLocker ml(&mutex); work(samples.get(), dest.get(), length); return dest; } diff --git a/samplebuffer.h b/samplebuffer.h index cfbac64..8fd439e 100644 --- a/samplebuffer.h +++ b/samplebuffer.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include #include "samplesource.h" @@ -28,6 +29,7 @@ class SampleBuffer : public SampleSource, public Subscriber { private: SampleSource *src; + QMutex mutex; public: SampleBuffer(SampleSource *src);