13d1aa5738
The long-deferred Android display stage (design/stats-unification.md; plan 4.1 of design/client-parity-and-network-resilience.md): AMediaCodec_setOnFrameRenderedCallback (API 26, under the minSdk-28 floor ⇒ hard-linked via ndk-sys) reports SurfaceFlinger's per-frame render timestamp, giving the HUD the spec's `display` = decoded→displayed term and the directly-measured capture→displayed end-to-end headline on both decode loops. Falls back per spec to the v1 capture→decoded endpoint on any window without render callbacks (the platform may drop them under load), and to it permanently if registration is refused. - The render timestamp arrives on CLOCK_MONOTONIC; it's re-based onto CLOCK_REALTIME against monotonic-now at callback time, which also cancels the (batchable) callback delivery lag. - The `ndk` crate exposes neither the callback nor the codec pointer needed to bind it raw, so the workspace pins `ndk` 0.9.0 to a vendored copy (clients/android/native/ vendor/ndk) whose ONLY change makes MediaCodec::as_ptr public — the "as_ptr patch". Workspace-excluded so host builds never compile it; drop when upstream exposes either. - nativeVideoStats grows to 26 doubles (22–25: dispValid, displayP50, e2eDispP50/P95; 0–21 unchanged for older readers); StatsOverlay moves headline endpoint + equation together so the equation always tiles the headline interval. Verified: host cargo check/test/clippy, aarch64-linux-android check/clippy, Kotlin app+kit+tests compile, roborazzi HUD render shows the full 4-term equation. Device verification rides plan 4.2's phone A/B. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
62 lines
3.9 KiB
TOML
62 lines
3.9 KiB
TOML
[package]
|
|
name = "punktfunk-client-android"
|
|
description = "punktfunk Android client — JNI bridge ('nativecore') over punktfunk-core (Rust-heavy client model)"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lib]
|
|
# `libpunktfunk_android.so` — loaded by Kotlin via `System.loadLibrary("punktfunk_android")`.
|
|
name = "punktfunk_android"
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
# The whole protocol/transport/FEC/crypto + the embeddable NativeClient connector. `quic` pulls
|
|
# the punktfunk/1 control plane (now ring-only — no aws-lc, see punktfunk-core/Cargo.toml).
|
|
punktfunk-core = { path = "../../../crates/punktfunk-core", features = ["quic"] }
|
|
jni = "0.21"
|
|
log = "0.4"
|
|
# LAN host discovery: browse the host's `_punktfunk._udp` mDNS advert — the SAME crate + service the
|
|
# Linux/Windows clients use (`crates/pf-client-core/src/discovery.rs`), replacing Android's per-OEM
|
|
# `NsdManager` system daemon with one tested browse path. Pure Rust (socket2/if-addrs/mio), so it
|
|
# cross-compiles to the Android targets AND builds on the host (the JNI seam links into
|
|
# `cargo build --workspace`). Kotlin keeps only the Wi-Fi `MulticastLock` + permission UX.
|
|
mdns-sd = "0.20"
|
|
|
|
# Android-only deps. Gated so `cargo build --workspace` on the Linux/macOS dev boxes + CI still
|
|
# compiles this crate (as a host cdylib) — the Android-framework glue (logging, AMediaCodec + AAudio
|
|
# via `ndk`, the Opus codec) is only pulled in for the real `*-linux-android` targets.
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
android_logger = "0.14"
|
|
# Feature bridge, no code here: punktfunk-core logs through `tracing`, but this client only
|
|
# installs `android_logger` (a `log` backend). Core transport warnings (e.g. "UDP socket buffer
|
|
# capped well below target") reach logcat only via tracing's "log" feature, which forwards events
|
|
# as `log` records when no tracing subscriber is set (always, here). Today that feature happens to
|
|
# be enabled transitively — quinn's default `log` feature unifies `tracing/log` onto the whole
|
|
# graph — but nothing about this client's logging should hinge on a QUIC crate's default feature
|
|
# set, so declare it explicitly.
|
|
tracing = { version = "0.1", default-features = false, features = ["std", "log"] }
|
|
# NDK bindings. "media" = AMediaCodec/ANativeWindow (video); "audio" = AAudio (audio playback).
|
|
# Pure-Rust FFI to libmediandk/libnativewindow/libaaudio — no C++/libc++_shared to bundle. Decode +
|
|
# audio run entirely in Rust on native threads (the "no async on the hot path" invariant).
|
|
# api-level-28 matches the app's minSdk floor (Android 9). AAudio (26), AMediaCodec (21) and
|
|
# ANativeWindow_setBuffersDataSpace (28) are all ≤28; the one API-30 call we make
|
|
# (ANativeWindow_setFrameRate) is dlsym-resolved at runtime (see decode::try_set_frame_rate), not
|
|
# linked, so the .so still loads on API 28/29.
|
|
ndk = { version = "0.9", features = ["media", "audio", "nativewindow", "api-level-28"] }
|
|
# Raw FFI for the one AMediaCodec entry point the `ndk` wrapper lacks:
|
|
# `AMediaCodec_setOnFrameRenderedCallback` (API 26, under the minSdk-28 floor ⇒ hard-linked) — the
|
|
# per-frame render-timestamp callback behind the HUD's `display` stage (see decode::DisplayTracker).
|
|
# Reaching it needs the codec's raw pointer, which is why the workspace pins `ndk` to the vendored
|
|
# copy whose only patch makes `MediaCodec::as_ptr` public (vendor/ndk, wired in the root Cargo.toml).
|
|
ndk-sys = { version = "0.6", features = ["media"] }
|
|
# setpriority/gettid to raise the decode thread toward URGENT_DISPLAY (see decode::boost_thread_priority).
|
|
libc = "0.2"
|
|
# Opus decode for the host→client audio plane (0xC9: 48 kHz stereo, 5 ms frames). Same crate the
|
|
# host + Linux client use. audiopus_sys vendors libopus (pure C) and builds it static via cmake —
|
|
# the cargo-ndk build sets LIBOPUS_STATIC=1/LIBOPUS_NO_PKG=1 so it links the bundled lib, not the host's.
|
|
opus = "0.3"
|