This is the big one — the Tauri Android app now has a real audio stack
capable of full-duplex VoIP, reusing the proven C++ Oboe bridge from the
legacy wzp-android crate.
Architecture:
- desktop/src-tauri/cpp/ — copies of oboe_bridge.{h,cpp}, oboe_stub.cpp,
and getauxval_fix.c from crates/wzp-android/cpp/. build.rs clones
google/oboe@1.8.1 into OUT_DIR and compiles the bridge + all Oboe
sources as "oboe_bridge" static lib, linking against shared libc++
(static would pull broken libc stubs that SIGSEGV in .so libraries).
- src/oboe_audio.rs — Rust side: an SPSC ring buffer matching the C++
bridge's AtomicI32 layout, plus OboeHandle::start() which returns
(capture_ring, playout_ring, owning_handle). The ring exposes the same
(available / read / write) methods as wzp_client::audio_ring::AudioRing
so CallEngine treats both backends interchangeably.
- src/engine.rs — compiled on every platform now. A cfg-switched type
alias picks wzp_client::audio_ring::AudioRing on desktop and
crate::oboe_audio::AudioRing on Android. The audio setup block has
three branches: VPIO/CPAL on macOS, CPAL on Linux/Windows, Oboe on
Android. Send/recv tasks are identical across platforms.
- src/lib.rs — removes all the "step 3 not done" Android stubs. The
engine module is no longer cfg-gated; connect / disconnect / toggle_mic
/ toggle_speaker / get_status are single implementations used by both
desktop and Android. Identity path resolves via app.path().app_data_dir()
from the Tauri setup() callback (already wired in step 1).
Runtime mic permission:
- scripts/build-tauri-android.sh now injects RECORD_AUDIO + MODIFY_AUDIO_
SETTINGS into gen/android/app/src/main/AndroidManifest.xml after init,
and overwrites MainActivity.kt with a version that calls
ActivityCompat.requestPermissions in onCreate. This is idempotent:
every build re-applies the patches so tauri re-init can't regress them.
Cargo.toml:
- cc is now an unconditional build-dep (build.rs runs on the host, so
target-gating build-deps doesn't work).
- wzp-client is now a dep on every platform. On Android it gets default
features only (no "audio"/"vpio") so CPAL isn't dragged in — oboe_audio
provides the capture/playout rings instead.
- tracing-android is added on Android so tracing events flow into logcat.
build.rs also gained embedded git hash (WZP_GIT_HASH) capture, which is
shown under the fingerprint on the home screen — already committed in
7639aaf, reinstated here alongside the Oboe build logic.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
934 B
C++
44 lines
934 B
C++
#ifndef WZP_OBOE_BRIDGE_H
|
|
#define WZP_OBOE_BRIDGE_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
#include <atomic>
|
|
typedef std::atomic<int32_t> wzp_atomic_int;
|
|
extern "C" {
|
|
#else
|
|
#include <stdatomic.h>
|
|
typedef atomic_int wzp_atomic_int;
|
|
#endif
|
|
|
|
typedef struct {
|
|
int32_t sample_rate;
|
|
int32_t frames_per_burst;
|
|
int32_t channel_count;
|
|
} WzpOboeConfig;
|
|
|
|
typedef struct {
|
|
int16_t* capture_buf;
|
|
int32_t capture_capacity;
|
|
wzp_atomic_int* capture_write_idx;
|
|
wzp_atomic_int* capture_read_idx;
|
|
|
|
int16_t* playout_buf;
|
|
int32_t playout_capacity;
|
|
wzp_atomic_int* playout_write_idx;
|
|
wzp_atomic_int* playout_read_idx;
|
|
} WzpOboeRings;
|
|
|
|
int wzp_oboe_start(const WzpOboeConfig* config, const WzpOboeRings* rings);
|
|
void wzp_oboe_stop(void);
|
|
float wzp_oboe_capture_latency_ms(void);
|
|
float wzp_oboe_playout_latency_ms(void);
|
|
int wzp_oboe_is_running(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // WZP_OBOE_BRIDGE_H
|