Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ class CallbackMaxSizeEnforcer : public AudioIODeviceCallback
jassert ((int) storedInputChannels.size() == numInputChannels);
jassert ((int) storedOutputChannels.size() == numOutputChannels);

// A device that is mid-reconfiguration can report a buffer size of 0
// (e.g. the JACK backend does this when its client is unavailable),
// which would otherwise make the chunking loop below spin forever on
// the audio thread. Emit a silent block instead; the next call to
// audioDeviceAboutToStart() will restore the real block size.
if (maximumSize <= 0)
{
for (int i = 0; i < numOutputChannels; ++i)
if (auto* channel = outputChannelData[i])
zeromem (channel, (size_t) numSamples * sizeof (float));

return;
}

int position = 0;

while (position < numSamples)
Expand Down