Skip to main content

wechat_calls/
lib.rs

1//! Voice-session and media building blocks without devices or persistence.
2//!
3//! Native call sessions consume the protocol crate's codecs and authenticated
4//! transport. Hosts supply account authority and operation journals. This crate
5//! does not open microphone/speaker devices or persist account credentials.
6//! Without default features, portable PCM, queue, pacing and mixing utilities
7//! remain available without the protocol or native codec dependencies.
8//!
9//! # Feature selection
10//!
11//! - Default `native-runtime`: native session/media integration, protocol and Opus.
12//! - `native-opus` alone: codec and portable utilities, without protocol.
13//! - No default features: portable utilities, including WebAssembly support.
14//!
15//! Native modules are only available outside WebAssembly. The host supplies
16//! execution; no Tokio runtime is created. The high-level account-bound calling
17//! service is not part of this release. Use the daemon Calls API for complete
18//! dial/join/invite/leave operations; see the crate README for integration limits.
19//!
20//! # Mix one source on a shared sample clock
21//!
22//! ```
23//! use wechat_calls::{audio::{AudioFormat, AudioFrame}, mixer::PcmMixer};
24//! let format = AudioFormat::new(16000, 1, 20)?;
25//! let mut mixer = PcmMixer::new(format, 2, 3, 0)?;
26//! mixer.add_track(7, 1)?;
27//! mixer.push(7, AudioFrame {
28//!     generation: 1, sequence: 0, timestamp: 0,
29//!     samples: vec![1000; format.samples_per_frame()],
30//! })?;
31//! assert_eq!(mixer.render(0)?.samples, vec![1000; 320]);
32//! # Ok::<(), wechat_calls::audio::MediaError>(())
33//! ```
34
35pub mod audio;
36pub mod mixer;
37pub mod ordering;
38pub mod pcm_output;
39pub mod playout;
40pub mod tone;
41pub mod track_queue;
42
43#[cfg(all(feature = "native-runtime", not(target_arch = "wasm32")))]
44#[doc(hidden)]
45pub mod admission;
46
47#[cfg(all(feature = "native-opus", not(target_arch = "wasm32")))]
48pub mod opus;
49
50#[cfg(all(feature = "native-runtime", not(target_arch = "wasm32")))]
51#[doc(hidden)]
52pub mod session;
53
54#[cfg(all(feature = "native-runtime", not(target_arch = "wasm32")))]
55pub mod conference_media;
56
57#[cfg(all(feature = "native-runtime", not(target_arch = "wasm32")))]
58pub mod conference_send;
59
60#[cfg(all(feature = "native-runtime", not(target_arch = "wasm32")))]
61#[doc(hidden)]
62pub mod native_media;