diff --git a/osu.Android/Native/CMakeLists.txt b/osu.Android/Native/CMakeLists.txt index 6d7e2357101a..f71cbc60e344 100644 --- a/osu.Android/Native/CMakeLists.txt +++ b/osu.Android/Native/CMakeLists.txt @@ -18,27 +18,24 @@ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,--gc-sections -s") # This reduces the Oboe portion of the binary by ~50%. set(OBOE_ENABLE_FLOWGRAPH OFF CACHE BOOL "Disable Oboe flowgraph to reduce binary size") -# Try pre-installed Oboe first (e.g. via Android NDK prefab or local install). -# If not found, download and build from source for CI/hermetic builds. -find_package(oboe QUIET CONFIG) - -if(oboe_FOUND) - set(OBOE_LIB oboe::oboe) -else() - include(FetchContent) - FetchContent_Declare(oboe - URL https://github.com/google/oboe/archive/refs/tags/1.10.0.tar.gz - ) - FetchContent_MakeAvailable(oboe) - # Patch Oboe's deprecated -Ofast flag - get_target_property(OBOE_OPTIONS oboe COMPILE_OPTIONS) - if(OBOE_OPTIONS) - string(REPLACE "-Ofast" "-O3;-ffast-math" OBOE_OPTIONS "${OBOE_OPTIONS}") - set_target_properties(oboe PROPERTIES COMPILE_OPTIONS "${OBOE_OPTIONS}") - endif() - set(OBOE_LIB oboe) +# Download and build Oboe 1.10.0 from source to ensure we have the latest +# features (like ADPF performance hints) regardless of the build environment. +include(FetchContent) +FetchContent_Declare(oboe + URL https://github.com/google/oboe/archive/refs/tags/1.10.0.tar.gz +) +FetchContent_MakeAvailable(oboe) + +# Patch Oboe's deprecated -Ofast flag to avoid build warnings/errors +# and ensure we use the same optimized flags as the rest of the project. +get_target_property(OBOE_OPTIONS oboe COMPILE_OPTIONS) +if(OBOE_OPTIONS) + string(REPLACE "-Ofast" "-O3;-ffast-math" OBOE_OPTIONS "${OBOE_OPTIONS}") + set_target_properties(oboe PROPERTIES COMPILE_OPTIONS "${OBOE_OPTIONS}") endif() +set(OBOE_LIB oboe) + find_library(vulkan-lib vulkan) find_library(log-lib log) find_library(android-lib android) diff --git a/osu.Android/Native/oboe_bridge.cpp b/osu.Android/Native/oboe_bridge.cpp index 9b4112bc7234..38597140d67d 100644 --- a/osu.Android/Native/oboe_bridge.cpp +++ b/osu.Android/Native/oboe_bridge.cpp @@ -43,7 +43,6 @@ bool OboeBridge::open() { ->setAudioApi(oboe::AudioApi::AAudio) ->setFramesPerCallback(oboe::kUnspecified) ->setBufferCapacityInFrames(oboe::kUnspecified) - ->setPerformanceHintEnabled(true) // Enable ADPF for dynamic performance management ->setChannelConversionAllowed(false) ->setFormatConversionAllowed(false) ->setCallback(this); @@ -62,6 +61,11 @@ bool OboeBridge::open() { return false; } + // Enable ADPF for dynamic performance management. + // This is only supported on AAudio streams on Android 12+ (API 31+). + // Oboe handles the internal version checks. + stream_->setPerformanceHintEnabled(true); + optimiseBufferSize(); LOGI("Oboe stream opened: api=%s, sampleRate=%d, framesPerBurst=%d, "