diff --git a/modules/juce_audio_devices/native/juce_android_Oboe.cpp b/modules/juce_audio_devices/native/juce_android_Oboe.cpp index ac24373adc..2e4ce8bc97 100644 --- a/modules/juce_audio_devices/native/juce_android_Oboe.cpp +++ b/modules/juce_audio_devices/native/juce_android_Oboe.cpp @@ -383,6 +383,15 @@ private: { auto bufferSizeHint = AndroidHighPerformanceAudioHelpers::getNativeBufferSizeHint(); + // providing a callback is required on some devices to get a FAST track, so we pass an + // empty one to the temp stream to get the best available buffer size + struct DummyCallback : public oboe::AudioStreamCallback + { + oboe::DataCallbackResult onAudioReady (oboe::AudioStream*, void*, int32_t) override { return oboe::DataCallbackResult::Stop; } + }; + + DummyCallback callback; + // NB: Exclusive mode could be rejected if a device is already opened in that mode, so to get // reliable results, only use this function when a device is closed. // We initially try to open a stream with a buffer size returned from @@ -395,7 +404,7 @@ private: getAndroidSDKVersion() >= 21 ? oboe::AudioFormat::Float : oboe::AudioFormat::I16, (int) AndroidHighPerformanceAudioHelpers::getNativeSampleRate(), bufferSizeHint, - nullptr); + &callback); if (auto* nativeStream = tempStream.getNativeStream()) return nativeStream->getFramesPerBurst();