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
77
78
79
80
81
//! Media codecs and RTP packetization.
//!
//! This module provides the [`Packetizer`] trait and codec-specific
//! implementations that convert raw encoded bitstreams into RTP packets.
//!
//! ## RTP overview (RFC 3550)
//!
//! Each encoded video frame is split into one or more RTP packets.
//! Every RTP packet carries a 12-byte fixed header ([`rtp::RtpHeader`])
//! containing:
//!
//! - **Sequence number** (16-bit, wrapping) — for reordering and loss detection.
//! - **Timestamp** (32-bit) — media clock, typically 90 kHz for video.
//! - **SSRC** (32-bit) — randomly chosen to identify the sender.
//! - **Marker bit** — set on the last packet of an access unit (frame).
//!
//! ## Supported codecs
//!
//! | Codec | Module | RFC | Status |
//! |-------|--------|-----|--------|
//! | H.264 | [`h264`] | [RFC 6184](https://tools.ietf.org/html/rfc6184) | Implemented |
//! | H.265 | [`h265`] | [RFC 7798](https://tools.ietf.org/html/rfc7798) | Planned |
//! | MJPEG | [`mjpeg`] | [RFC 2435](https://tools.ietf.org/html/rfc2435) | Planned |
/// Codec-specific RTP packetizer.
///
/// Each supported codec implements this trait, providing:
/// - **Packetization**: splitting encoded data into RTP-sized packets
/// - **SDP attributes**: codec parameters for the DESCRIBE response
/// - **RTP metadata**: payload type, clock rate, sequence/timestamp state
///
/// The generic RTP header is handled by [`rtp::RtpHeader`] — packetizers
/// compose it rather than reimplementing header serialization.
///
/// ## Implementing a new codec
///
/// 1. Create a new module (e.g. `media/aac.rs`)
/// 2. Implement `Packetizer` for your type
/// 3. Wire it into [`crate::mount::Mount`] via [`crate::Server::add_mount`]