1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! # rtp-engine
//!
//! A pure Rust RTP media engine for VoIP applications.
//!
//! This crate provides the building blocks for real-time audio communication:
//!
//! - **Codecs**: G.711 (μ-law/A-law) and Opus encoding/decoding
//! - **RTP/RTCP**: Packet construction, parsing, and statistics
//! - **SRTP**: Secure RTP with AES-CM-128-HMAC-SHA1-80
//! - **Audio devices**: Cross-platform capture and playback via cpal
//! - **Resampling**: Sample rate conversion between codecs and devices
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use rtp_engine::{MediaSession, CodecType};
//! use std::net::SocketAddr;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let remote: SocketAddr = "192.168.1.100:5004".parse()?;
//!
//! // Start a media session with G.711 μ-law
//! let session = MediaSession::start(10000, remote, CodecType::Pcmu).await?;
//!
//! // The session captures from mic and plays to speaker automatically
//! // Send DTMF
//! session.send_dtmf("1");
//!
//! // Mute/unmute
//! session.set_mute(true);
//!
//! // Get statistics
//! let stats = session.stats();
//! println!("Packets sent: {}", stats.packets_sent);
//!
//! // Stop when done
//! session.stop();
//! Ok(())
//! }
//! ```
//!
//! ## Feature Flags
//!
//! - `g711` (default): G.711 μ-law and A-law codecs
//! - `opus`: Opus codec support (requires libopus)
//! - `srtp`: SRTP/SRTCP encryption
//! - `device`: Audio device capture/playback via cpal
// Re-exports for convenience
pub use CodecType;
pub use ;
pub use ;
pub use ;
pub use RtpStats;
pub use MediaSession;
pub use SrtpContext;