samplebuffer: Acquire lock during work function

This commit is contained in:
Mike Walters
2016-03-27 03:59:25 +01:00
parent 270f44ccbe
commit 43a77e8f6d
2 changed files with 4 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QMutexLocker>
#include "samplebuffer.h"
template <typename Tin, typename Tout>
@@ -39,6 +40,7 @@ std::unique_ptr<Tout[]> SampleBuffer<Tin, Tout>::getSamples(off_t start, off_t l
return nullptr;
std::unique_ptr<Tout[]> dest(new Tout[length]);
QMutexLocker ml(&mutex);
work(samples.get(), dest.get(), length);
return dest;
}