From f3bf91b9b19704fe2a33810b8a9f25627a0ec08f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 30 Apr 2022 17:25:53 -0600 Subject: [PATCH] fix another use of a reader lock by a source (comments explain more) --- libs/ardour/audiosource.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 5481c7a649..768bfd8959 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -308,7 +308,14 @@ AudioSource::read (Sample *dst, samplepos_t start, samplecnt_t cnt, int /*channe { assert (cnt >= 0); - ReaderLock lm (_lock); + /* as odd as it may seem, given that this method is used to *read* the + * source, that we would need a write lock here. The problem is that + * the audio file API we use (libsndfile) does not allow concurrent use + * of the same SNDFILE object, even for reading. Consequently, even + * readers must be serialized. + */ + + WriterLock lm (_lock); return read_unlocked (dst, start, cnt); }