//! Native `WebRTC` voice adapter corresponding to `LibreMetaverse.Voice.WebRTC`. //! //! `ICE`, `DTLS`, `SRTP`, `RTP`, `SCTP` data, `Opus` media, controls, and teardown //! run in Rust. System `libopus` is required; the optional `real-audio` feature //! adds the cross-platform `CPAL` hardware boundary while default tests use //! virtual audio. extern crate self as libremetaverse_voice_webrtc; #[allow(clippy::all, clippy::pedantic)] // Public shapes mirror the pinned C# API. mod compatibility; mod generated; mod native; pub use compatibility::VoiceLogRecord; pub use generated::*; pub use libremetaverse as core; pub use libremetaverse_structured_data as structured_data; pub use libremetaverse_types::Error; pub use native::*; #[derive(Clone, Debug, PartialEq)] struct JsonValueInner(serde_json::Value); /// Project-owned boundary types for external JSON signatures. pub mod signaling { /// Owned JSON value without exposing the implementation's JSON crate in /// the public compatibility boundary. #[derive(Clone, Debug, PartialEq)] pub struct JsonValue(crate::JsonValueInner); impl JsonValue { /// Parses one complete JSON value. /// /// # Errors /// /// Returns [`crate::Error::Argument`] when `value` is not valid JSON. pub fn parse(value: &str) -> Result { serde_json::from_str(value) .map(crate::JsonValueInner) .map(Self) .map_err(|_| crate::Error::Argument) } /// Serializes the value as compact JSON. /// /// # Errors /// /// Returns [`crate::Error::Argument`] if serialization fails. pub fn to_json(&self) -> Result { serde_json::to_string(&self.0.0).map_err(|_| crate::Error::Argument) } pub(crate) fn into_inner(self) -> serde_json::Value { self.0.0 } pub(crate) fn from_inner(value: serde_json::Value) -> Self { Self(crate::JsonValueInner(value)) } } } /// Project-owned boundary types for external WebRTC transport signatures. pub mod transport { #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct RTCDataChannel { pub label: String, pub ready: bool, } #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct RTCPeerConnection { pub connected: bool, } } /// Project-owned boundary types for external media signatures. pub mod media { #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub struct AudioSamplingRatesEnum(pub i32); } /// Project-owned boundary types for external audio signatures. pub mod audio { #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub struct NoiseSuppressionLevel(pub i32); #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct SoundFlowAudioEndPoint { pub id: String, } #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct SoundFlowAudioSource { pub id: String, } }