feat(android): initialise Oboe runtime context
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
related in-call audio routing operations. -->
|
related in-call audio routing operations. -->
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
|
|
||||||
<!-- SDD-trace: cpal-on-Android research report; supports SCO/BLE
|
<!-- SDD-trace: Android Oboe voice backend; supports SCO/BLE
|
||||||
headset routing on API 31+. Declared here so the platform
|
headset routing on API 31+. Declared here so the platform
|
||||||
allows querying / connecting to bonded Bluetooth audio devices
|
allows querying / connecting to bonded Bluetooth audio devices
|
||||||
for the voice session. -->
|
for the voice session. -->
|
||||||
|
|||||||
+3
-3
@@ -29,9 +29,9 @@ class MainActivity : FlutterActivity() {
|
|||||||
companion object {
|
companion object {
|
||||||
/**
|
/**
|
||||||
* JNI entry point implemented in `chanora_bridge::android_init`.
|
* JNI entry point implemented in `chanora_bridge::android_init`.
|
||||||
* Initialises `ndk_context` with our Activity so cpal-on-Oboe can
|
* Initialises `ndk_context` with our Activity so the direct Oboe
|
||||||
* find Android audio services when `chanora_audio` starts the
|
* backend can find Android audio services when `chanora_audio`
|
||||||
* capture / playback streams.
|
* starts the capture / playback streams.
|
||||||
*
|
*
|
||||||
* Trace: SDD-105 (AndroidJniBootstrap). Signature must remain stable;
|
* Trace: SDD-105 (AndroidJniBootstrap). Signature must remain stable;
|
||||||
* the Rust side declares the matching `extern "system"` symbol.
|
* the Rust side declares the matching `extern "system"` symbol.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
|
|||||||
|
|
||||||
# Android: route `tracing` output to logcat so a user can see protocol
|
# Android: route `tracing` output to logcat so a user can see protocol
|
||||||
# and audio diagnostics via `adb logcat -s chanora`. Also brings in the
|
# and audio diagnostics via `adb logcat -s chanora`. Also brings in the
|
||||||
# JNI bindings we need to initialise `ndk_context` for cpal-on-Oboe.
|
# JNI bindings we need to initialise `ndk_context` for the Android Oboe backend.
|
||||||
[target.'cfg(target_os = "android")'.dependencies]
|
[target.'cfg(target_os = "android")'.dependencies]
|
||||||
tracing-android = "0.2"
|
tracing-android = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Android-specific JNI lifecycle helpers.
|
//! Android-specific JNI lifecycle helpers.
|
||||||
//!
|
//!
|
||||||
//! On Android the Flutter engine starts our cdylib but does not push
|
//! On Android the Flutter engine starts our cdylib but does not push
|
||||||
//! anything into `ndk_context` (the global the cpal-on-Oboe backend
|
//! anything into `ndk_context` (the global the Android Oboe backend
|
||||||
//! reads to find Android audio services). Without that, the first
|
//! reads to find Android audio services). Without that, the first
|
||||||
//! audio call hangs / fails.
|
//! audio call hangs / fails.
|
||||||
//!
|
//!
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
//! application Context. That JNI function pushes both the
|
//! application Context. That JNI function pushes both the
|
||||||
//! `JavaVM*` and a `Context` global ref into `ndk_context`.
|
//! `JavaVM*` and a `Context` global ref into `ndk_context`.
|
||||||
//!
|
//!
|
||||||
//! After that, cpal can open the default input/output devices.
|
//! After that, the Android Oboe backend can open the default
|
||||||
|
//! input/output devices.
|
||||||
|
|
||||||
#![cfg(target_os = "android")]
|
#![cfg(target_os = "android")]
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ pub extern "system" fn JNI_OnLoad(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Called by `MainActivity.onCreate` with the application Context.
|
/// Called by `MainActivity.onCreate` with the application Context.
|
||||||
/// Initialises the `ndk_context` so cpal's Oboe backend can locate
|
/// Initialises the `ndk_context` so the Oboe backend can locate
|
||||||
/// the Android audio services.
|
/// the Android audio services.
|
||||||
///
|
///
|
||||||
/// Symbol mangling note: Kotlin / JNI mangles the underscore in
|
/// Symbol mangling note: Kotlin / JNI mangles the underscore in
|
||||||
|
|||||||
Reference in New Issue
Block a user