Prevent processing until buffersize change is complete

This fixes async callback from CoreAudio via
AudioDeviceAddPropertyListener. Apparently in rare cases it can
happen that the property listener calls back concurrently with
processing on M1 machines using Rosetta.

https://pastebin.com/upvc9LTc Thread 44 vs. Thread 32

May also be caused by plugin(s) taking a long time to
change buffersize. Processing continues even though the
buffersize callback has not yet completed.

PS. I have not been able to reproduce this on an Intel
machine, even with excessive buffersize changes. However
since buffersize changes cannot (usually) happen concurrently
with processing, taking the lock is reasonable.
This commit is contained in:
Robin Gareus 2021-10-04 22:30:08 +02:00
parent e2efb698e0
commit 5925ee0b7c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -210,6 +210,7 @@ AudioEngine::sample_rate_change (pframes_t nframes)
int
AudioEngine::buffer_size_change (pframes_t bufsiz)
{
Glib::Threads::Mutex::Lock pl (_process_lock);
set_port_buffer_sizes (bufsiz);
if (_session) {