Browse Source

CoreAudio: Avoid race on currentSampleRate data member of AudioIODeviceCombiner

v7.0.9
reuk 3 years ago
parent
commit
6cd2ed022d
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp

+ 4
- 4
modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp View File

@@ -1605,8 +1605,7 @@ public:
}
}
open (inputChannelsRequested, outputChannelsRequested,
newSampleRate, newBufferSize);
open (inputChannelsRequested, outputChannelsRequested, newSampleRate, newBufferSize);
start (cb);
}
@@ -1914,7 +1913,8 @@ private:
struct DeviceWrapper : public AudioIODeviceCallback
{
DeviceWrapper (AudioIODeviceCombiner& cd, std::unique_ptr<CoreAudioIODevice> d, bool shouldBeInput)
: owner (cd), device (std::move (d)),
: owner (cd),
device (std::move (d)),
input (shouldBeInput)
{
device->setAsyncRestarter (&owner);
@@ -1974,7 +1974,7 @@ private:
std::uint64_t nsToSampleTime (std::uint64_t ns) const noexcept
{
return static_cast<std::uint64_t> (std::round (static_cast<double> (ns) * owner.currentSampleRate * 1e-9));
return static_cast<std::uint64_t> (std::round (static_cast<double> (ns) * device->getCurrentSampleRate() * 1e-9));
}
void updateSampleTimeFromContext (const AudioIODeviceCallbackContext& context) noexcept


Loading…
Cancel
Save