Skip to content
Merged
Show file tree
Hide file tree
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
35 changes: 16 additions & 19 deletions osu.Android/Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion osu.Android/Native/oboe_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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, "
Expand Down
Loading