fix(android): adapt fold layout and diagnostics

This commit is contained in:
Edison Jwa
2026-05-20 14:52:34 +09:00
parent 30ff955439
commit 3ae8e1ab77
3 changed files with 80 additions and 71 deletions
+7 -22
View File
@@ -440,14 +440,13 @@ impl AndroidVoiceUnit {
let input_share = share_from_oboe(input_stream.get_sharing_mode());
let input_sample_rate = input_stream.get_sample_rate();
let input_frames_per_burst = input_stream.get_frames_per_burst();
let session_id = match input_stream.get_session_id() {
SessionId::None => None,
// `SessionId::Allocate` is the request value; once a
// stream is open, oboe returns the concrete allocated
// id via `SessionId::Id(i32)` in some versions or via
// a getter — defensively match.
other => session_id_value(other),
};
let session_id = None;
warn!(
target: "chanora_audio",
"android: oboe-rs get_session_id is skipped because oboe 0.6.1 \
panics on some Android allocated-session values; hardware \
effects are disabled for this stream"
);
// --- Open output stream (SDD-112) --------------------------
let output_builder = AudioStreamBuilder::default()
@@ -829,20 +828,6 @@ fn share_from_oboe(s: SharingMode) -> AchievedSharingMode {
}
}
fn session_id_value(sid: SessionId) -> Option<AudioSessionId> {
// SessionId is a Rust enum from oboe-rs. `Allocate` is the
// request token; once allocated the platform returns a positive
// integer carried in the enum's tuple variant. Match explicitly
// — `mem::transmute` would be UB on a non-`#[repr(i32)]` enum,
// even if it happens to lay out correctly today.
match sid {
SessionId::None => None,
// `SessionId::Allocate` is a request marker; treat it as
// "id not yet known" rather than fabricating one.
SessionId::Allocate => None,
}
}
// --- SDD-113 hardware-effect binding -----------------------------
//
// We attach `AcousticEchoCanceler`, `NoiseSuppressor`,