BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / src / android.rs

android.rs

android.rs 1.7 KiB Download Raw
1// Copyright 2025 LiveKit, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#[cfg(target_os = "android")]
16#[cxx::bridge(namespace = "livekit_ffi")]
17pub mod ffi {
18 unsafe extern "C++" {
19 include!("livekit/android.h");
20
21 type JavaVM;
22
23 /// Initialize Android WebRTC with the JVM.
24 /// Called automatically by init_android_context(), so only call directly
25 /// in JNI_OnLoad or when you don't have an Android Context.
26 /// Idempotent - safe to call multiple times.
27 unsafe fn init_android(vm: *mut JavaVM);
28
29 /// Initialize Android WebRTC with the application context.
30 /// This is the main init function - calls init_android() internally,
31 /// then initializes ContextUtils for PlatformAudio.
32 /// Idempotent - safe to call multiple times.
33 ///
34 /// # Arguments
35 /// * `jvm` - The JavaVM pointer
36 /// * `context` - The Android application context (jobject as usize)
37 ///
38 /// # Returns
39 /// true if context init succeeded, false otherwise.
40 /// Note: JVM init always happens regardless of return value.
41 unsafe fn init_android_context(jvm: *mut JavaVM, context: usize) -> bool;
42 }
43}