#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::result_large_err)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::field_reassign_with_default)]
extern crate alloc;
pub mod prelude {
pub use alloc::borrow::{Cow, ToOwned};
pub use alloc::boxed::Box;
pub use alloc::collections::{BTreeMap, BTreeSet};
pub use alloc::string::{String, ToString};
pub use alloc::sync::{Arc, Weak};
pub use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
pub use alloc::{format, vec};
}
pub mod config;
pub mod errors;
pub mod media;
pub mod peer_connection;
pub mod platform;
pub mod rtp;
pub mod rtx;
pub mod sdp;
pub mod srtp;
pub mod stats;
pub mod stats_collector;
#[cfg(feature = "t38")]
pub mod t38;
pub mod transports;
pub use config::{
ApplicationCapability, AudioCapability, BundlePolicy, CertificateConfig,
ExternalIpCandidateType, IceCredentialType, IceServer, IceTcpPolicy, IceTransportPolicy,
MediaCapabilities, RecorderInterceptors, RtcConfiguration, RtcConfigurationBuilder,
RtcpMuxPolicy, SdpCompatibilityMode, T38Capability, T38FaxRateManagement, T38UdpEC,
TransportMode, VideoCapability,
};
pub use errors::{RtcError, RtcResult, SdpError, SdpResult};
#[cfg(feature = "std")]
pub use peer_connection::{
DisconnectReason, IceConnectionState, IceGatheringState, PeerConnection, PeerConnectionEvent,
PeerConnectionState, RtpCodecParameters, RtpReceiverInterceptor, RtpSender,
RtpSenderInterceptor, RtpTransceiver, SignalingState, TransceiverDirection,
rtcp_fb_enables_nack,
};
#[cfg(feature = "std")]
pub use sdp::{
AddressType, Attribute, Direction, MediaKind, MediaSection, NetworkType, Origin, SDES_MID_URI,
SdpType, SessionDescription, SessionSection, Timing, modify_sdp_direction,
parse_bundle_mid_info,
};
pub use srtp::{SrtpContext, SrtpDirection, SrtpKeyingMaterial, SrtpProfile, SrtpSession};
#[cfg(feature = "std")]
pub use stats::{
DynProvider, StatsEntry, StatsId, StatsKind, StatsProvider, StatsReport, gather_once,
};
#[cfg(feature = "std")]
pub use transports::ice::{
DEFAULT_LEASE_DURATION, DEFAULT_UPNP_DISCOVERY_TIMEOUT, IceCandidate, IceCandidatePair,
IceCandidateType, IceGathererState, IceRole, IceTransport, IceTransportState,
MAX_LEASE_DURATION, MIN_LEASE_DURATION, TcpType, UpnpPortMapper,
};
#[cfg(feature = "std")]
pub use transports::rtp::{RtpRewriteBridgeOptions, RtpRewriteBridgeParams, RtpRewriteRule};
#[cfg(feature = "std")]
pub use transports::sctp::{DataChannelEvent, DataChannelState, SctpLinkStats};
#[cfg(feature = "std")]
pub use transports::udptl::{UdtlConfig, UdtlReceiveBuffer, UdtlTransport};
#[cfg(feature = "std")]
use std::future::Future;
#[cfg(feature = "std")]
use tracing::Instrument;
#[cfg(feature = "std")]
#[inline]
pub(crate) fn spawn_rtc<F>(
handle: Option<&tokio::runtime::Handle>,
span: tracing::Span,
fut: F,
) -> tokio::task::JoinHandle<()>
where
F: Future<Output = ()> + Send + 'static,
{
let fut = fut.instrument(span);
match handle {
Some(h) => h.spawn(fut),
None => tokio::spawn(fut),
}
}
#[cfg(not(feature = "std"))]
#[inline]
pub(crate) fn spawn_rtc<F>(
_handle: Option<&crate::config::RuntimeHandle>,
_span: tracing::Span,
fut: F,
) where
F: Future<Output = ()> + Send + 'static,
{
crate::platform::task::spawn(fut);
}